uni-app trinocular listener properties calculation uni-app

三目运算

<text>{{mag>10 ? '优秀' : ""}}</text>
        
三目运算的高级用法
大于1000用kg表示  小于1000,用g表示  添加括号是因为提高他的优先级哈
<text>{{weight > 1000 ? (weight/1000)+"kg" : weight}}</text>        

uni-app listens attribute is the same with vue Kazakhstan

Click on the main page [] Normal operation will conflict with the law of value listening watch Oh! ! !

    监听属性哈  安卓也是可以的哈  小程序   H5
        <view>
            <text>{{mag}}</text>
        </view>
        
         <button type="primary" @tap="anniu">页面主操作 Normal</button>

         data:{
                     mag:0
                 },
         methods: {
            anniu(){
                this.mag=this.mag+1;
            }
         },
         watch:{
            mag:function(new,old){
                console.log("watch",this.mag)
            }
         }

Guess you like

Origin www.cnblogs.com/IwishIcould/p/12184453.html