ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

jsx中使用插槽

2026/9/21 16:10:29 拓冰建站 浏览量
jsx中使用插槽

1. jsx语法中使用插槽

以elementplus ElPopconfirm 为例

<el-popconfirm title="Are you sure to delete this?"><template #reference><el-button>Delete</el-button></template></el-popconfirm>

使用

      slots: {default: (data: any) => {const slot = {reference: () => (<div>{1111}</div>)}return (<><ElPopconfirm title="Are you sure to delete this?" v-slots={slot}></ElPopconfirm></>)}}