<script type=”text/javascript”>
        window.onload = function(){
            var app = new Vue({
                el:”#app”,
                data:{
                upp:0,
                low:0
            },
            watch:{
                upp:function(val){
                this.upp = val;
                this.low = val.toLowerCase();
            },
                low:function(val){     
                this.low = val;
                this.upp = val.toUpperCase();
            }
          }
         });
     
        }
     
       </script>
 
vue代码至此就全都写完了,下面要html出场啦!
   <div id=”app”>

                大写:<input type=”text” v-model = “upp” />
               
                小写:<input type=”text” v-model = “low”/>
   </div>
 
 
运行效果图:

 

版权声明:本文为lutt原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/lutt/p/10098712.html