vue页面点击按钮拉起弹窗

时间:2024-10-27 07:51:13
// 1、使用插槽 slot-scope="scope" <template slot-scope="scope"> //父传子将id传入拉起得子页面detailHandle() //通过点击时间拉起弹窗,并将数据传给子级 <el-button @click="detailHandle()" type="text" size="small">拉起页面</el-button> //<!-- 融资申请详情对话框 (被拉起来的弹窗)--> //<!--子传父的方法: @refreshDataList="getDataList"--> //<!--引入的弹窗组件: ref="detail" --> <detail v-if="detailVisiable" ref="detail" @refreshDataList="getDataList" :pwidth="dWidth"></detail> </template> export default { import detail from '../financingApply/financingApply-detail'; name: "applyAndStatistical", data() { return { detailVisiable:false, //设置默认弹窗为隐藏 } } methods: { detailHandle(id){ //设置弹窗的显示隐藏 this.detailVisiable=true; //父传子 this.$nextTick(() => { this.$refs.detail.init(id); }); }, } }