其他分享
首页 > 其他分享> > 这个怎么也显示不出来

这个怎么也显示不出来

作者:互联网

<div id="app" class="demo">
   <child @greet="sayHello"></child>
  </div>
   <script src="https://unpkg.com/vue@next"></script>
   <script>
   const app = Vue.createApp({});
   app.component('child', {
     data: function() {
       return {
         name: '张三'
       }
      },
       methods: {
         handleClick() {
           this.$emit('greet', this.name);
         }
       },
       template: '<button @click="handlerClick">开始欢迎</button>',
       sayHello(name) {
         alert("Hello," + name )
       }
   })
   
.mount('#app')
     </script>

标签:怎么,显示,createApp,name,出来,app,sayHello,const,methods
来源: https://blog.csdn.net/weixin_40945354/article/details/119380790