为了账号安全,请及时绑定邮箱和手机立即绑定

vue子组件通过事件向父级组件发送消息怎么不成功啊

vue子组件通过事件向父级组件发送消息怎么不成功啊

LEATH 2018-09-23 16:55:17
初学vue,照着官网实例敲的,怎么点击按钮字体没有变大啊Html代码:<body><div id="blog-posts-events-demo">     <div :style="{ fontSize: postFontSize + 'em' }">         <blog-post                 v-for="post in posts"                 v-bind:key="post.id"                 v-bind:post="post"         ></blog-post>     </div></div></body>js代码 Vue.component('blog-post', {         props: ['post'],         template: `     <div class="blog-post" v-on:enlarge-text="postFontSize+=0.1">       <h3>{{ post.title }}</h3>       <button v-on:click="$emit('enlarge-text')">         Enlarge text       </button>       <div v-html="post.content"></div>     </div>`     })          let a = new Vue({         el: '#blog-posts-events-demo',         data: {             posts: [                 {id: 1, content: 'My journey with Vue', title: '1'},                 {id: 2, content: 'Blogging with Vue', title: '2'},                 {id: 3, content: 'Why Vue is so fun', title: '3'}             ],             postFontSize: 1         }     })
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 513 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信