1234567891011121314151617181920212223242526272829 |
- <template>
- <h2>父级组件</h2>
- <h1>msg: {{ msg }}</h1>
- <button @click="msg += '==='">更新数据</button>
- <hr>
- <Child :msg = "msg"></Child>
- </template>
- <script lang="ts">
- import { defineComponent,ref } from 'vue'
- import Child from "./components/Child.vue"
- export default defineComponent({
- setup () {
- const msg = ref('在干嘛')
- return {
- msg
- }
- },
- components: {
- Child
- }
- })
- </script>
- <style scoped>
- </style>
|