vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
43 lines (42 loc) • 1.28 kB
JavaScript
import { defineComponent as x, useTemplateRef as l, createElementBlock as c, openBlock as f, createElementVNode as i, createCommentVNode as E, unref as e, toDisplayString as k } from "vue";
import { useFold as _ } from "./hook/useFold.mjs";
const y = ["aria-label"], B = /* @__PURE__ */ x({
name: "Fold",
__name: "index",
props: {
text: { default: "" },
max: {},
ellipsis: { default: "..." },
expand: { default: "更多" },
collapse: { default: "收起" },
but: { type: Boolean }
},
setup(o) {
const t = o, n = l("foldEl"), a = l("contentEl"), s = l("textEl"), { localExpanded: r, isClamped: m, handleToggleExpand: d } = _(t, n, a, s);
return (b, p) => (f(), c("div", {
ref_key: "foldEl",
ref: n,
class: "app-fold",
"aria-label": o.text
}, [
i("span", {
ref_key: "contentEl",
ref: a
}, [
i("span", {
ref_key: "textEl",
ref: s
}, null, 512),
(e(m) || e(r)) && t.but ? (f(), c("span", {
key: 0,
class: "is-more",
onClick: p[0] || (p[0] = //@ts-ignore
(...u) => e(d) && e(d)(...u))
}, k(e(r) ? t.collapse : t.expand), 1)) : E("", !0)
], 512)
], 8, y));
}
});
export {
B as default
};