单项数据流

来源:互联网 发布:linux 解压包指定目录 编辑:程序博客网 时间:2024/06/05 20:31

在vue里总是有一些残缺的例子看不懂。。。。。

单项数据流

定义一个计算属性,处理 prop 的值并返回 的用法

看例子:

<div id="app">    <input type="text" v-model="message">    <child v-bind:my-message="message"></child></div><script>     Vue.component('child', {        props: ['myMessage'],        computed:{          toLower:function(){              return {toLo:this.myMessage.trim().toLowerCase(),toUp:this.myMessage.trim().toUpperCase()          }          }        },        template: "<div>{{myMessage}} <p>{{toLower.toLo}}</p><p>{{toLower.toUp}}</p></div>"    });    new Vue({        el: '#app',        data: {            message: ''        }    })</script>
原创粉丝点击