文章目录
问题描述
- 第二个
child
会受到第一个child
的影响而线上666
的值
html
<template>
<child :value="666" />
<child />
</template>
<script>
import child from './child';
export default {
components: {
child,
},
data() {
return {};
},
computed: {},
methods: {},
watch: {},
mounted() {},
};
</script>
解决方法
- 第二个
child2
就不会显示child1
中666
的值了
html
<template>
<child1 :value="666" />
<child2 />
</template>
<script>
export default {
components: {
child1: () => import('./child'),
child2: () => import('./child'),
},
data() {
return {};
},
computed: {},
methods: {},
watch: {},
mounted() {},
};
</script>