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

vue實(shí)現(xiàn)搜索過(guò)濾效果

 更新時(shí)間:2019年05月28日 09:11:54   作者:郭豪楊  
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)搜索過(guò)濾效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue實(shí)現(xiàn)搜索過(guò)濾效果的具體代碼,供大家參考,具體內(nèi)容如下

html:

<table id="tfhover_1" class="tftable_1" border="1">
  <tr>
    <th>名稱</th>
    <th>鏈接狀態(tài)</th>
    <th>IP</th>
    <th>特例類型</th>
    <th>所屬城市</th>
    <th>所屬機(jī)房</th>
  </tr>
  <tr v-cloak v-for="(item, index) of slist">
    <td>{{item.name}}</td>
    <td>{{item.username}}</td>
    <td>{{item.email}}</td>
    <td>{{item.sex}}</td>
    <td>{{item.province}}</td>
    <td>{{item.hobb}}</td>
    <!--<td><a href="javascript:;" rel="external nofollow" rel="external nofollow" @click="showOverlay(index)">修改</a> | <a href="javascript:;" rel="external nofollow" rel="external nofollow" @click="del(index)">刪除</a></td>-->
  </tr>
</table>

css:

[v-cloak] {
  display: none
}
table {
  border: 1px solid #ccc;
  padding: 0;
  border-collapse: collapse;
  table-layout: fixed;
  /*margin-top: 10px;*/
  width: 100%;
  margin-top: 45px;
}
table td,
table th {
  height: 30px;
  border: 1px solid #ccc;
  background: #fff;
  font-size: 2vh;
  padding: 12px 3px 6px 8px;
  color: #666666;
  font-weight: 300;
}
table th:first-child {
  width: 4rem;
}
.container,
.st {
  /*width: 1000px;*/
  margin: 10px auto 0;
  font-size: 13px;
  font-family: '微軟雅黑'
}
.container .search {
  font-size: 15px;
  padding: 4px;
}
.container .add {
  padding: 5px 15px;
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  background: rgba(0, 0, 0, 0.7);
}
.overlay td:first-child {
  width: 8rem;
}
.overlay .con {
  position: absolute;
  /*width: 420px;*/
  min-height: 300px;
  background: #fff;
  left: 50%;
  top: 50%;
  -webkit-transform: translate3d(-50%, -50%, 0);
  transform: translate3d(-50%, -50%, 0);
  /*margin-top: -150px;*/
  padding: 20px;
}
 
.span_1{
  font-size: 18px;
  color: #666666;
}

js:

Vue.component('model', {
 
  template: '',
  props: ['list', 'isactive'],
  computed: {
    modifylist() {
      return this.list;
    }
  },
  methods: {
    changeActive() {
      this.$emit('change');
    },
    modify() {
      this.$emit('modify', this.modifylist);
    },
    add(){
 
    }
  }
});
 
 
var app = new Vue({
  el: '#app',
  data: {
    isActive: false,
    selected: -1,
    selectedlist: {},
    slist: [],
    searchlist: [],
    list: [
      {
        name:'Fe1',
        username: '開',
        email: '221.122.62.221',
        sex: '特例1',
        province: '北京',
        hobb:'電子機(jī)房'
      },
      {
        name:'Fe2',
        username: '關(guān)',
        email: '192.168.12.222',
        sex: '特例2',
        province: '上海',
        hobb: '服務(wù)機(jī)房'
      },
      {
        name:'Fe3',
        username: '開',
        email: '127.255.255.255',
        sex: '特例3',
        province: '重慶',
        hobb: '遙控機(jī)房'
      },
      {
        name:'Fe4',
        username: '關(guān)',
        email: '223.255.255.255',
        sex: '特例4',
        province: '北京市',
        hobb:'內(nèi)網(wǎng)機(jī)房'
      }
    ]
  },
  created() {
    this.setSlist(this.list);
  },
  methods: {
    // 修改數(shù)據(jù)
    showOverlay(index) {
      this.selected = index;
      this.selectedlist = this.list[index];
      this.changeOverlay();
    },
    // 點(diǎn)擊保存按鈕
    modify(arr) {
      if (this.selected > -1) {
        Vue.set(this.list, this.selected, arr);
        this.selected = -1;
      } else {
        this.list.push(arr);
      }
      this.setSlist(this.list);
 
      this.changeOverlay();
    },
 
    del(index) {
      this.list.splice(index, 1);
      this.setSlist(this.list);
    },
    changeOverlay() {
      this.isActive = !this.isActive;
    },
    // 獲取需要渲染到頁(yè)面中的數(shù)據(jù)
    setSlist(arr) {
      this.slist = JSON.parse(JSON.stringify(arr));
    },
    // 搜索
    search() {
      var v = $('.search').val(),
        self = this;
      self.searchlist = [];
      if (v) {
        var ss = [];
        // 過(guò)濾需要的數(shù)據(jù)
        this.list.forEach(function (item) {
          if (item.province.indexOf(v) > -1) {
            if (self.searchlist.indexOf(item.province) == -1) {
              self.searchlist.push(item.province);
            }
            ss.push(item);
          } else if (item.hobb.indexOf(v) > -1) {
            if (self.searchlist.indexOf(item.hobb) == -1) {
              self.searchlist.push(item.hobb);
            }
            ss.push(item);
          }
        });
        this.setSlist(ss); // 將過(guò)濾后的數(shù)據(jù)給了slist
      } else {
        // 沒有搜索內(nèi)容,則展示全部數(shù)據(jù)
        this.setSlist(this.list);
      }
    }
  },
  watch: {
  }
})

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Element Steps步驟條的使用方法

    Element Steps步驟條的使用方法

    這篇文章主要介紹了Element Steps步驟條的使用方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-07-07
  • vue實(shí)現(xiàn)界面滑動(dòng)效果

    vue實(shí)現(xiàn)界面滑動(dòng)效果

    這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)界面滑動(dòng)效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-07-07
  • Vue組件生命周期運(yùn)行原理解析

    Vue組件生命周期運(yùn)行原理解析

    這篇文章主要介紹了Vue組件生命周期運(yùn)行原理解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-11-11
  • vue模塊拖拽實(shí)現(xiàn)示例代碼

    vue模塊拖拽實(shí)現(xiàn)示例代碼

    這篇文章主要介紹了vue模塊拖拽實(shí)現(xiàn)示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-03-03
  • VUE el-tree組件左邊勾選,右邊清除交互問題

    VUE el-tree組件左邊勾選,右邊清除交互問題

    這篇文章主要介紹了VUE el-tree組件左邊勾選,右邊清除交互問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。
    2023-04-04
  • vue3+vite實(shí)現(xiàn)低版本瀏覽器兼容的解決方案(出現(xiàn)白屏問題)

    vue3+vite實(shí)現(xiàn)低版本瀏覽器兼容的解決方案(出現(xiàn)白屏問題)

    項(xiàng)目全線使用vue3的時(shí)候,自然使用的是配套更加契合的vite打包工具,于是自然而然會(huì)用到很多新的語(yǔ)法,本文給大家介紹了vue3+vite實(shí)現(xiàn)低版本瀏覽器兼容的解決方案(出現(xiàn)白屏問題),需要的朋友可以參考下
    2024-04-04
  • 詳解vue過(guò)濾器在v2.0版本用法

    詳解vue過(guò)濾器在v2.0版本用法

    本篇文章主要介紹了vue過(guò)濾器在v2.0版本用法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-06-06
  • Vue+Vite+Axios項(xiàng)目多環(huán)境以及部署前后端跨域

    Vue+Vite+Axios項(xiàng)目多環(huán)境以及部署前后端跨域

    本文介紹了如何在Vue+Vite+Axios項(xiàng)目中處理多環(huán)境部署和跨域問題,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2024-11-11
  • vue項(xiàng)目中導(dǎo)入swiper插件的方法

    vue項(xiàng)目中導(dǎo)入swiper插件的方法

    這篇文章主要介紹了vue項(xiàng)目中導(dǎo)入swiper插件的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-01-01
  • Vue2如何支持composition API示例詳解

    Vue2如何支持composition API示例詳解

    這篇文章主要為大家介紹了Vue2如何支持composition API示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-01-01

最新評(píng)論

吉林市| 容城县| 民权县| 阜宁县| 新丰县| 称多县| 河间市| 威信县| 昂仁县| 理塘县| 彭州市| 宝丰县| 和硕县| 色达县| 乐都县| 即墨市| 上饶市| 科技| 义乌市| 砀山县| 无极县| 晋中市| 富川| 东丽区| 子长县| 正宁县| 武强县| 沾益县| 禹州市| 法库县| 宜君县| 濮阳市| 乐都县| 榆社县| 兖州市| 南通市| 石泉县| 新宁县| 三都| 澄迈县| 伊川县|