SOURCE

console 命令行工具 X clear

                    
>
console
Vue.component('child', {
    props: {
        visible: Boolean
    },
    template: '<div>我是子组件<button v-show="visible" @click="hideParent">隐藏父组件的按钮</button></div>',
    methods: {
        hideParent() {
            this.$emit('hideparent')
        }
    }
})

const vm = new Vue({
    el: '#app',
    data() {
        return {
            visible: true,
            parentShow: true
        }
    },
    methods: {
        hide() {
            this.parentShow = false
        }
    }
})
<div id="app">
	<div>
		我是父组件
		<button v-show="parentShow" @click="visible = false">隐藏子组件的按钮</button>
        <child :visible="visible" @hideparent="hide"></child>
    </div>
</div>

本项目引用的自定义外部资源