欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

基于Vue.js實(shí)現(xiàn)tab滑塊效果

本文實(shí)例為大家分享了Vue.js實(shí)現(xiàn)tab滑塊效果的具體代碼,供大家參考,具體內(nèi)容如下

我們擁有十多年網(wǎng)頁設(shè)計(jì)和網(wǎng)站建設(shè)經(jīng)驗(yàn),從網(wǎng)站策劃到網(wǎng)站制作,我們的網(wǎng)頁設(shè)計(jì)師為您提供的解決方案。為企業(yè)提供做網(wǎng)站、成都網(wǎng)站建設(shè)、微信開發(fā)、微信小程序定制開發(fā)、成都手機(jī)網(wǎng)站制作H5響應(yīng)式網(wǎng)站、等業(yè)務(wù)。無論您有什么樣的網(wǎng)站設(shè)計(jì)或者設(shè)計(jì)方案要求,我們都將富于創(chuàng)造性的提供專業(yè)設(shè)計(jì)服務(wù)并滿足您的需求。

基于Vue.js實(shí)現(xiàn)tab滑塊效果

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <meta http-equiv="X-UA-Compatible" content="ie=edge">
 <script src="../lib/vue.min.js"></script>
 <style>
  *{margin:0;padding:0;}
  #tabPanel .itemname{height:40px;width:180px;margin-bottom:10px;}
  #tabPanel .itemcontent{height:40px;width:180px;}
  #tabPanel .addbtn{width:100px;height:30px;}
  #tabPanel .active{background:#eee;}
  #tabPanel{height:340px;width:500px;margin:100px auto;}
  #tabPanel .tab{height:40px;background:#ccc;margin-top:10px;}
  #tabPanel .tab ul li{list-style: none;float:left;width:80px;height:40px;text-align:center;line-height:40px;}
  #tabPanel .content{height:300px;width:500px;background:#eee;}
 </style>
 <title>Vue.js編寫tab滑塊效果</title>
</head>
<body>
 <div id="tabPanel">
  <label>添加滑塊名稱:<input type="text" v-model="tabItem" class="itemname"></label><br>
  <label>添加滑塊內(nèi)容:<input type="text" v-model="tabContent" class="itemcontent"></label><br>
  <input type="button" value="添加選項(xiàng)" @click="addItem()" class="addbtn">
  <div class="tab">
   <ul>
    <li v-for="(value, index) in tabs" v-bind:class="{active: index == num }" @mouseover="toggle(index)" @dblclick="del(index)">{{value}}</li>
   </ul>
  </div>
  <div class="content">
   <div class="box" v-for="(value, index) in tabContents" v-show="index == num" contenteditable="true" @blur="editContent(index,value)">{{value+index}}</div>
  </div>
 </div>
</body>
<script>
 var v = new Vue ({
  el: "#tabPanel",
  data: {
   tabs: ["第一項(xiàng)","第二項(xiàng)"],
   tabContents: ["第一項(xiàng)內(nèi)容","第二項(xiàng)內(nèi)容"],
   num: 0,
   tabItem:"",
   tabContent:""
  },
  methods:{
   //切換滑塊
   toggle: function(index){
    this.num = index;
   },
   //添加滑塊
   addItem: function(){
    if(this.tabItem == "" || this.tabContent == ""){
     alert("填寫完整的名稱和內(nèi)容");
    }else{
     this.tabs.push(this.tabItem);
     this.tabContents.push(this.tabContent);
    }
   },
   //雙擊刪除滑塊
   del: function(index){
    this.tabs.splice(index,1);
    this.tabContents.splice(index,1)
   },
   //編輯選項(xiàng)內(nèi)容
   editContent: function(index,value){
    this.tabContents[index] = value;
    console.log(this.tabContents);
   }
  }
 });
</script>
</html>

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

當(dāng)前名稱:基于Vue.js實(shí)現(xiàn)tab滑塊效果
文章源于:http://chinadenli.net/article48/gophep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管網(wǎng)站排名、App設(shè)計(jì)、云服務(wù)器做網(wǎng)站、網(wǎng)站營銷

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)