<!-- @date: 2020-08-12 10:57:26 -->
<template>
<div class="testView">{{test}}</div>
</template>
<script>
export default {
data() {
return {};
},
inject: ["getTest"],
computed: {
test() {
return this.getTest();
},
},
};
</script>
<template>
<div>
<!-- <router-view /> -->
<test-view />
</div>
</template>
<script>
import testView from "./testView";
export default {
components: {
testView,
},
provide() {
return {
getTest: this.getTest
}
},
methods: {
getTest() {
return this.test;
},
},
data() {
return {
test: 1,
form: {
filds: [
{ id: 3, name: "wanghaoyu", age: 23 },
{ id: 4, name: "wanghaoyu1", age: 24 },
],
},
};
},
mounted() {
setInterval(() => {
this.test++;
}, 1000);
},
};
</script>