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>

 

上一篇:yii2 composer安装


下一篇:昇腾研究之路