子组件
<button type="button" v-on:click="submit">确定</button>
//js
export default {
props:["titleName","id","order"],
methods: {
submit:function(){
this.$emit("ok",[this.titleName,this.id,this.order]) // 向父级传递["xiha",123,3]。
}
}
}
父组件
<index-popup v-on:ok="submit"></index-popup>
//js
export default {
data() {
return {
titleName:"hahaha",
id:132155,
time:"1000",
order:1,
seen:false,
}
},
components: {
'index-popup': IndexPopup
},
methods: {
submit:function(arr){
console.log(arr)
this.titleName=arr[0];
this.id=arr[1];
this.order=arr[2];
}
}
}
网友评论