子组件<template> <div class="top-title"> <h1>你需要支付¥{{money}}</h1> </div></template><script> export default { name: "payMent", props: { money:{ default: 0 } } }</script>父组件<template> <div class=""> <pay-ment money="money"></pay-ment> <a @click='changCost'>改变支付费用<> </div></template><script> import payMent from '../components/payMent.vue' export default { name: "pay", data: { money: 33 }, components: { payMent }, methods:{ changCost: function(){ this.money = 88; //-这里父组件值改变了,而子组件的没有改变,还是33,没有变成88 } } }
添加回答
举报
0/150
提交
取消