Vue2.0 弹窗方法之一(父子传输方法)

使用$emit实现子组件 向父组件传输数值实现


第一步   在子组件 children.vue , methods 一个方法

	// html编辑
	
	

	// js编辑
	
	


第二步  在父组件App.vue中编辑


// js编辑
export default {
	data () {
		return {
			istrue: false
		}
	},
	methods: {
		openwindows () {  // 打开弹窗
			this.istrue = !this.istrue
			console.log(this.istrue)
		},
		closewindows () {  // 关闭弹窗
			this.istrue = !this.istrue
			console.log(this.istrue)
		},
	}
}


你可能感兴趣的:(vue)