|
@@ -1,8 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
<h1 class="h-26 text-6xl">Provide-inject</h1>
|
|
<h1 class="h-26 text-6xl">Provide-inject</h1>
|
|
|
- <h3 class="h-16 text-4xl"></h3>
|
|
|
|
|
- <h3 class="h-16 text-4xl"></h3>
|
|
|
|
|
|
|
+ <h3 class="h-16 text-4xl">我有{{ car }}辆车</h3>
|
|
|
<hr class="h-15" />
|
|
<hr class="h-15" />
|
|
|
<hr class="h-15" />
|
|
<hr class="h-15" />
|
|
|
<Child></Child>
|
|
<Child></Child>
|
|
@@ -10,7 +9,13 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
|
|
+import { ref, reactive, provide } from "vue";
|
|
|
import Child from "./Child.vue";
|
|
import Child from "./Child.vue";
|
|
|
|
|
+let car = ref(10);
|
|
|
|
|
+provide("x", { car });
|
|
|
|
|
+// provide("x", { car });
|
|
|
|
|
+// provide("x", { car });
|
|
|
|
|
+// provide("x", { car });
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|