弹窗
在vue中结合elementui.在父组件中通过点击事件,控制子组件弹窗显示
- 将父组件的值通过props的方式传递给子组件弹窗
- 子组件通过computed的方式来获取值和设置新值,在set中调用$emit(‘update:porp’)方法
- 整个过程通过.sync来完成数据的双向流通
父组件
<template>
<div class="rightsContainer">
<el-button size="small" @click="showDialog = !showDialog">显示弹窗</el-button>
<cardCustomRightsDialog :visible.sync="showDialog"></cardCustomRightsDialog>
</div>
</template