其他分享
首页 > 其他分享> > Vue实战--学习笔记310(计算属性)

Vue实战--学习笔记310(计算属性)

作者:互联网

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="../Vue/vue.min.js" type="text/javascript"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="name" placeholder="你的名字"  />
        <h1>你好 :{{reversedText}}</h1>
    </div>
    <script >
        var app = new Vue(
        {
            el:"#app",
            data:
            {
                name:'1234,5678'
            },
            computed: {
                reversedText: function () {
                    return this.name.split(',').reverse().join(',');
                }
            }
              

        })
        console.log(app.name);
    </script>
</body>
</html>

 

标签:function,el,Vue,name,--,app,310,reversedText
来源: https://www.cnblogs.com/sportdog/p/15094926.html