最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Vue實現(xiàn)用戶自定義字段顯示數(shù)據(jù)的方法

 更新時間:2018年08月28日 10:48:14   作者:codingNoob  
今天小編就為大家分享一篇Vue實現(xiàn)用戶自定義字段顯示數(shù)據(jù)的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

如下:

代碼:

<!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>
    .middle::-webkit-scrollbar {height:8px;}
    /* 滾動槽 */
    .middle::-webkit-scrollbar-track {border-radius: 10px;}
    /* 滾動條滑塊 */
    .middle::-webkit-scrollbar-thumb {background: #ccc;}
    * {margin: 0;padding: 0;box-sizing:border-box;font-family: "微軟雅黑";}
    #tabPanel{width:1100px;height:300px;margin:100px auto;}
    .left{float:left;height:300px;width:300px;font-size:0;}
    .left .item,.right .item,.middle .item{display:inline-block;width:100px;}
    .left .item span,.middle .item span,.left .item span{display:block;height:50px;text-align:center;line-height:50px;font-size:14px;border:1px solid #eee;}
    .right .item{width:200px;height:50px;line-height:50px;text-align:center;border:1px solid #eee;}
    .right .item span{display:inline-block;border:none;color:blue;text-decoration: underline;cursor:pointer;}
    .middle{float:left;height:300px;width:300px;font-size:0;overflow-x:scroll;overflow-y:hidden;}
    .right{float:left;height:300px;width:200px;}
    #tabPanel .chooseItem {padding:10px 0;}
    #tabPanel .chooseItem label{padding:0 10px;}
  </style>
  <title>Vue實現(xiàn)自定義字段數(shù)據(jù)</title>
</head>

<body>

  <div id="tabPanel">
    <div class="chooseItem">
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.weight">體重</label>
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.inter">興趣</label>
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.schoold">學校</label>
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.district">所屬地區(qū)</label>
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.class">所屬年級</label>
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.math">數(shù)學</label>
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.chinese">語文</label>
      <label @click="chooseFile()"><input type="checkbox" @click.stop="" v-model="field.english">英語</label>
    </div>
    <div class="left">
      <div class="item">
        <span>編號</span>
        <span v-for="(item, index) in students">{{item.id}}</span>
      </div>
      <div class="item">
        <span>姓別</span>
        <span v-for="(item, index) in students">{{item.sex}}</span>
      </div>
      <div class="item">
        <span>身高</span>
        <span v-for="(item, index) in students">{{item.hight}}</span>
      </div>
    </div>
    <div class="middle">
      <div :style="{width: (length*100) + 'px'}">
        <div class="item" v-show="field.weight">
          <span>體重</span>
          <span v-for="(item, index) in students">{{item.weight}}</span>
        </div>
        <div class="item" v-show="field.inter">
          <span>興趣</span>
          <span v-for="(item, index) in students">{{item.inter}}</span>
        </div>
        <div class="item" v-show="field.schoold">
          <span>學校</span>
          <span v-for="(item, index) in students">{{item.schoold}}</span>
        </div>
        <div class="item" v-show="field.district">
          <span>所屬地區(qū)</span>
          <span v-for="(item, index) in students">{{item.district}}</span>
        </div>
        <div class="item" v-show="field.class">
          <span>所屬年級</span>
          <span v-for="(item, index) in students">{{item.class}}</span>
        </div>
        <div class="item" v-show="field.math">
          <span>數(shù)學</span>
          <span v-for="(item, index) in students">{{item.math}}</span>
        </div>
        <div class="item" v-show="field.chinese">
          <span>語文</span>
          <span v-for="(item, index) in students">{{item.chinese}}</span>
        </div>
        <div class="item" v-show="field.english">
          <span>英語</span>
          <span v-for="(item, index) in students">{{item.english}}</span>
        </div>
      </div>
    </div>
    <div class="right">
      <div class="item">
        <span>操作</span>
      </div>
      <div class="item" v-for="(item, index) in students">
        <span @click="detail(item.id ,index)" :title="item.id">查看</span>
        <span @click="detail(item.id ,index)" :title="item.id">刪除</span>
        <span @click="detail(item.id ,index)" :title="item.id">修改</span>
        <span @click="detail(item.id ,index)" :title="item.id">凍結(jié)</span>
      </div>
    </div>
  </div>
</body>
<script>
  var v = new Vue({
    el: "#tabPanel",
    data: {
      length: 3,
      field:{
        weight: true,
        inter: true,
        schoold: true,
        district: false,
        class: false,
        math: false,
        chinese: false,
        english: false
      },
      students:[{
        id: 1,
        name: 'zhangsan01',
        sex: '男',
        hight: '168cm',
        weight: '56kg',
        inter: '籃球1',
        schoold: '清華大學1',
        district: '湖南省1',
        class: '大學三年級1',
        math: '97',
        chinese: '98',
        english: '120'
      },{
        id: 2,
        name: 'zhangsan02',
        sex: '男',
        hight: '168cm',
        weight: '56kg',
        inter: '籃球2',
        schoold: '清華大學2',
        district: '湖南省2',
        class: '大學三年級2',
        math: '97',
        chinese: '98',
        english: '120'
      },{
        id: 3,
        name: 'zhangsan03',
        sex: '男',
        hight: '168cm',
        weight: '56kg',
        inter: '籃球3',
        schoold: '清華大學3',
        district: '湖南省3',
        class: '大學三年級3',
        math: '97',
        chinese: '98',
        english: '120'
      },{
        id: 4,
        name: 'zhangsan04',
        sex: '男',
        hight: '168cm',
        weight: '56kg',
        inter: '籃球4',
        schoold: '清華大學4',
        district: '湖南省4',
        class: '大學三年級4',
        math: '97',
        chinese: '98',
        english: '120'
      },{
        id: 5,
        name: 'zhangsan05',
        sex: '男',
        hight: '168cm',
        weight: '56kg',
        inter: '籃球5',
        schoold: '清華大學5',
        district: '湖南省5',
        class: '大學三年級5',
        math: '97',
        chinese: '98',
        english: '120'
      }]
    },
    methods: {
      //雙擊刪除滑塊
      del: function(index) {
        this.tabs.splice(index, 1);
        this.tabContents.splice(index, 1)
      },
      //編輯選項內(nèi)容
      editContent: function(index, value) {
        this.tabContents[index] = value;
        console.log(this.tabContents);
      },
      chooseFile: function(){
        var val = this.field;
        //this.length = 0;
        for (i in val){
          if(val[i]){
            this.length = this.length + 1;
          }
          //console.log(val.lenght)
        }
        if(this.length > 8){
          this.length = 8;
        }
        console.log(this.length);
      }
    },
    computed: {
      lengthb: function(){
        if(length > 6){
          lengthb = 6
        }
      }
    },
    watch: {
      field: function(val){

        //console.log(this.field.lenght);
      }
    }
  });
</script>

</html>

以上這篇Vue實現(xiàn)用戶自定義字段顯示數(shù)據(jù)的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • 關(guān)于element Drawer抽屜的使用

    關(guān)于element Drawer抽屜的使用

    這篇文章主要介紹了關(guān)于element Drawer抽屜的使用方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-07-07
  • vue實現(xiàn)圖片按比例縮放問題操作

    vue實現(xiàn)圖片按比例縮放問題操作

    這篇文章主要介紹了vue實現(xiàn)圖片按比例縮放問題操作,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-08-08
  • Vue內(nèi)容分發(fā)slot(全面解析)

    Vue內(nèi)容分發(fā)slot(全面解析)

    下面小編就為大家?guī)硪黄猇ue內(nèi)容分發(fā)slot(全面解析)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-08-08
  • Vite性能優(yōu)化之分包策略的實現(xiàn)

    Vite性能優(yōu)化之分包策略的實現(xiàn)

    本文主要介紹了Vite性能優(yōu)化之分包策略的實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-05-05
  • Vue使用electron轉(zhuǎn)換項目成桌面應用方法介紹

    Vue使用electron轉(zhuǎn)換項目成桌面應用方法介紹

    Electron也可以快速地將你的網(wǎng)站打包成一個原生應用發(fā)布,下面這篇文章主要給大家介紹了關(guān)于Vue和React中快速使用Electron的相關(guān)資料,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考下
    2022-11-11
  • 基于vue3?vue-cli4?線上部署及優(yōu)化的問題

    基于vue3?vue-cli4?線上部署及優(yōu)化的問題

    這篇文章主要介紹了基于vue3?vue-cli4?線上部署及優(yōu)化的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-06-06
  • Vue無法讀取HTMLCollection列表的length問題解決

    Vue無法讀取HTMLCollection列表的length問題解決

    這篇文章主要介紹了Vue無法讀取HTMLCollection列表的length問題解決方案,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-03-03
  • 詳解基于Vue/React項目的移動端適配方案

    詳解基于Vue/React項目的移動端適配方案

    這篇文章主要介紹了詳解基于Vue/React項目的移動端適配方案,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-08-08
  • Vue實用功能之實現(xiàn)拖拽元素、列表拖拽排序

    Vue實用功能之實現(xiàn)拖拽元素、列表拖拽排序

    在日常開發(fā)中,特別是管理端,經(jīng)常會遇到要實現(xiàn)拖拽排序的效果,下面這篇文章主要給大家介紹了關(guān)于Vue實用功能之實現(xiàn)拖拽元素、列表拖拽排序的相關(guān)資料,需要的朋友可以參考下
    2022-10-10
  • Vue基礎知識快速入門教程

    Vue基礎知識快速入門教程

    這篇文章主要介紹了Vue基礎知識快速入門教程,我們可以先學會用,使用一段時間之后,回頭來熟悉一下Vue框架以及它的特點,需要的朋友可以參考下
    2023-05-05

最新評論

长寿区| 奉节县| 临海市| 定兴县| 望奎县| 五华县| 马尔康县| 原平市| 抚远县| 万安县| 宣恩县| 怀集县| 禹州市| 富阳市| 凤台县| 滦平县| 和田县| 湾仔区| 大荔县| 施秉县| 自治县| 资源县| 临邑县| 鄂尔多斯市| 泗洪县| 台北县| 枣庄市| 侯马市| 云阳县| 沿河| 甘肃省| 三亚市| 漳平市| 石林| 彭山县| 阳泉市| 炎陵县| 天祝| 绥滨县| 惠州市| 紫阳县|