码迷,mamicode.com
首页 > 其他好文 > 详细

computed

时间:2018-07-30 20:20:18      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:computed   col   属性   nbsp   派生   mode   数据   v-model   处理   

computed 计算属性(派生值,附加值)

基于原来的属性,对数据进行处理,不改变原数据

    let myInput = {
        template:`  <div>
                        <input v-model="msg">
                        <br>
                        <span>{{changeMsg}}</span>
                    </div>`,
        data() {
            return {
                msg:‘hello‘
            }
        },
        computed:{
            changeMsg() {
                return this.msg.split(‘‘).join()
            }
        }
    }
    new Vue({
        el: "#app",
        components:{
            myInput
        }
    })
 

 

computed

标签:computed   col   属性   nbsp   派生   mode   数据   v-model   处理   

原文地址:https://www.cnblogs.com/goff-mi/p/9392345.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!