This commit is contained in:
Code12121 2022-11-03 10:10:24 +08:00
parent 196c5597a4
commit 55211d24cb
1 changed files with 4 additions and 1 deletions

View File

@ -20,11 +20,14 @@
</body> </body>
<script src="../../JavaScript/vue.js"></script> <script src="../../JavaScript/vue.js"></script>
<script> <script>
// this.$children.内容 那取的是所有组件,如果需要那制定的组件需要加一个下标
// this.$ref.自定义名称.内容 通过组件标签上的ref=“名称”拿取标签,不会因为组件的增加而改变位置
new Vue({ new Vue({
el:"#app", el:"#app",
methods:{ methods:{
add(){ add(){
this.$refs.show.num+=1 // this.$refs.show.num+=1
this.$children[0].num+=1
}, },
remove(){ remove(){
this.$refs.show.num-=1 this.$refs.show.num-=1