国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

vue和bootstrap的示例分析

發(fā)布時(shí)間:2021-07-27 11:48 來(lái)源:億速云 閱讀:0 作者:小新 欄目: web開(kāi)發(fā)

這篇文章給大家分享的是有關(guān)vue和bootstrap的示例分析的內容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

vue和angular非常像都是MVVM。道理都是想通的,就是語(yǔ)法的差異 

我覺(jué)得vue和angular區別: 

1.vue更輕,更便捷,適用于移動(dòng)開(kāi)發(fā) 

2.vue更簡(jiǎn)單。。 

angular和vue指令的差別大致就是 ng-xxx和v-xxx。 
vue是用過(guò)new Vue創(chuàng )建實(shí)例,然后在屬性data綁定數據,在屬性methods里添加方法。 
vue的循環(huán)遍歷是 v-for=“” ,事件是 v-on:clicl =“”;

直接上代碼。

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>Title</title>
 <link rel="stylesheet" href="bootstrap.css" rel="external nofollow" >
 <style>
  tr{
   vertical-align: inherit;
  }
 </style>
 <script src="jquery.js"></script>
 <script src="bootstrap.js"></script>
 <script src="node_modules/vue/dist/vue.js"></script>
 <script>
  window.onload= function(){
   var vm = new Vue({
    el:'.container',
    data:{
     myData:[],
     username:'',
     age:''
    },
    methods:{
     add:function(){
      this.myData.push({
       name:this.username,
       age:this.age
      });
      this.username="";
      this.age="";
     },
     reset:function(){
      this.username="";
      this.age="";
     },
     del:function(index){
      this.myData.splice(index,1)
     },
     delAll:function(){
      this.myData=[];
     }
    }
   })
  }
 </script>
</head>
<body>
 <div class="container">
  <form role="form">
   <div class="form-group">
    <label for="username">用戶(hù)名:</label>
    <input placeholder="輸入用戶(hù)名" type="text"
      v-model="username"
      id="username" class="form-control">
   </div>
   <div class="form-group">
    <label for="age">年齡:</label>
    <input placeholder="輸入年齡" type="text"
      v-model="age"
      id="age" class="form-control">
   </div>
   <div class="form-group">
    <input type="button" class="btn btn-info" v-on:click="add()" value="添加">
    <input type="button" class="btn btn-info" v-on:click="reset()" value="重置">
   </div>
  </form>
  <hr>
  <table class="table table-bordered table-hover">
   <caption>用戶(hù)信息表</caption>
   <tr class="text-danger">
    <td class="text-center">序號</td>
    <td class="text-center">名字</td>
    <td class="text-center">年齡</td>
    <td class="text-center">操作</td>
   </tr>
   <tr v-for="(item,index) in myData">
    <td class="text-center">{{index+1}}</td>
    <td class="text-center">{{item.name}}</td>
    <td class="text-center">{{item.age}}</td>
    <td class="text-center">
     <button class="btn btn-danger btn-sm"
      v-on:click="del(index)"
      data-toggle="dialog" data-target="#layer"
     >刪除</button>
    </td>
   </tr>
   <tr v-show="myData.length!=0">
    <td colspan="4" class="text-right">
     <button v-on:click="delAll()" class="btn btn-danger btn-sm">刪除全部</button>
    </td>
   </tr>
   <tr v-show="myData.length==0">
    <td colspan="4" class="text-center">
     <p>暫無(wú)數據</p>
    </td>
   </tr>
  </table>
 </div>


</body>
</html>

效果:

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自互聯(lián)網(wǎng)轉載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權請聯(lián)系站長(cháng)郵箱:ts@56dr.com進(jìn)行舉報,并提供相關(guān)證據,一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容。

老熟妇BBXXX视频| 精品无码国产污污污免费| 在线涩涩免费观看国产精品| 精品久久久久久综合日本| 国语自产拍在线观看2019| YYY6080韩国三级理论|