<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>lesson 18</title> <script src="https://unpkg.com/vue@next"></script> </head> <body> <div id="root"></div> </body> <script> const app = Vue.createApp({ data() { return { count: 1 } }, template: ` <counter v-model="count" /> ` }); app.component('counter', { props: ['modelValue'], methods: { handleClick() { this.$emit('update:modelValue', this.modelValue + 3); } }, template: ` <div @click="handleClick">{{modelValue}}</div> ` }); const vm = app.mount('#root'); </script> </html>
            // 原來的子組件向父組件傳遞數據 需要用 emit  再 在父組件用方法接收  
         
 
         
             //  現在 vue3.0 更新了 v-model  
         
 
        