💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
~~~ <div id="app"> <counter :count="2" ref="one" @change="handleChange"></counter> <counter :count="3" ref="two" @change="handleChange"></counter> <div>{{total}}</div> </div> ~~~ ~~~ var counter ={ props:['count'], data:function(){ return{ number:this.count } }, methods:{ handleClick(){ this.number++ this.$emit('change',1) } }, template:"<div @click='handleClick'>{{number}}</div>" } var vm = new Vue({ el:"#app", components:{ counter }, data:{ total:5 }, methods:{ handleChange(option){ this.total = this.total+option; } } }) ~~~