UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

2 lines (1 loc) 954 B
"use strict";const e=require("vue"),u=require("./hook/useFold.cjs"),f=["aria-label"],i=e.defineComponent({name:"Fold",__name:"index",props:{text:{default:""},max:{},ellipsis:{default:"..."},expand:{default:"更多"},collapse:{default:"收起"},but:{type:Boolean}},setup(l){const t=l,n=e.useTemplateRef("foldEl"),o=e.useTemplateRef("contentEl"),a=e.useTemplateRef("textEl"),{localExpanded:s,isClamped:d,handleToggleExpand:r}=u.useFold(t,n,o,a);return(m,c)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"foldEl",ref:n,class:"app-fold","aria-label":l.text},[e.createElementVNode("span",{ref_key:"contentEl",ref:o},[e.createElementVNode("span",{ref_key:"textEl",ref:a},null,512),(e.unref(d)||e.unref(s))&&t.but?(e.openBlock(),e.createElementBlock("span",{key:0,class:"is-more",onClick:c[0]||(c[0]=(...p)=>e.unref(r)&&e.unref(r)(...p))},e.toDisplayString(e.unref(s)?t.collapse:t.expand),1)):e.createCommentVNode("",!0)],512)],8,f))}});module.exports=i;