父组件
<Button type="text" style="text-align:right" class="check" @click="openModalRechange">立即充值</Button>
<!-- 充值弹框 -->
<modalRechange :controlRefresh="controlRefresh" :modalRechange="modalRechange" @changeBindModal="changeBindModal"></modalRechange>
data:{
modalRechange:true,//是否展开充值弹框
controlRefresh: 1,//控制刷新
}
methods: {
openModalRechange(){
let that = this;
that.modalRechange = true;
that.controlRefresh++
},
changeBindModal(val) {
this.modalRechange = val;
this.controlRefresh=1
},
},
弹框子组件
<template>
<Modal
v-model="isShow"
title="充值信息"
class="auto-modal"
footer-hide
:width="810"
@on-visible-change="visibleHandle"
>
lldldldlddd
</Modal>
</template>
<script>
export default {
name: "",
props: ["controlRefresh"],
data() {
return {
isShow: false
};
},
watch: {
controlRefresh(count) {
// 控制刷新 获取接口 避免请求接口
if (count > 1) {
this.isShow = true;
}
},
isShow(newValue, oldValue){
if (!newValue) {
// 重置数据
}
}
},
computed: {},
created() {},
methods: {
visibleHandle(val) {
this.$emit("changeBindModal", val);
},
},
};
</script>
<style lang="scss" scoped>
</style>