|
@@ -0,0 +1,16 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <h1>GrandSon</h1>
|
|
|
+ <p>爷爷给了我{{sum}}本书</p>
|
|
|
+ <p>爷爷给了我一辆{{car.c1}}和一辆{{car.c2}}</p>
|
|
|
+ <button @click="buyBook(2)">给爷爷买书</button>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ref, reactive, inject } from "vue";
|
|
|
+let {sum,car,buyBook} = inject('a')
|
|
|
+console.log( inject('a','demo'))
|
|
|
+console.log( inject('b'),'222')
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped></style>
|