vue基础学习之computed

xiaoxiao2021-02-28  29

<script type="text/javascript" src="js/vue.js" ></script> <div id="app"> level {{level}} </div> <script type="text/javascript"> var app =new Vue({ el:'#app', data:{ points:'90', }, computed:{ level:function(){ if(this.points<=100){ return "普通会员" } return "vip会员" } } }) </script> <div id="app"> level {{username}} <input type="text" v-model="first" /> <input type="text" v-model="last" /> </div> <script type="text/javascript"> var app =new Vue({ el:'#app', data:{ first:'jerry', last:'jack' }, computed:{ username:function(){ return this.first+" "+this.last; } } }) </script>
转载请注明原文地址: https://www.6miu.com/read-2799995.html

最新回复(0)