<template>
<div>
<el-button @click="show">按钮</el-button>
<add-or-update :addOrUpdateVisible="addOrUpdateVisible" @changeShow="showAddOrUpdate" ref="addOrUpdateRef">
</add-or-update>
</div>
</template>
<script>
import AddOrUpdate from './Edit'
export default {
data () {
return {
addOrUpdateVisible: false
}
},
components: {
AddOrUpdate
},
methods: {
show () {
this.addOrUpdateVisible = true
},
showAddOrUpdate (data) {
if (data === 'false') {
this.addOrUpdateVisible = false
} else {
this.addOrUpdateVisible = true
}
}
}
}
</script>
<template>
<el-dialog title="提示" :visible.sync="showDialog" width="50%" @close="handleClose">
<span>这是一段信息</span>
<span slot="footer" class="dialog-footer">
<el-button @click="showDialog = false">取 消</el-button>
<el-button type="primary" @click="showDialog = false">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
export default {
props:{
addOrUpdateVisible:{
type: Boolean,
default: false
}
},
data(){
return{
showDialog:false
}
},
methods:{
handleClose(){
this.$emit('changeShow', 'false')
}
},
watch:{
addOrUpdateVisible(oldVal, newVal){
this.showDialog = this.addOrUpdateVisible
},
}
}
</script>