vue实现筛选功能,文字选中变色


<template>
<Poptip trigger="hover" title="Title" content="content">
<i-button>Hover</i-button>
</Poptip>
<Poptip trigger="hover" title="Title" content="content">
<i-button>Hover</i-button>
</Poptip>
<Poptip trigger="hover" title="Title" content="content">
<i-button>Hover</i-button>
</Poptip>
<Poptip trigger="hover" title="Title" content="content">
<i-button>Hover</i-button>
</Poptip>
<Poptip title="" content="content">
<i-button>筛选</i-button>
<div class="api" slot="content">
<Tabs :animated="false" v-model="currentTab" @on-click="currentTabChanged">
<tab-pane label="学院" name="xy">
<i-row v-for="item in xyList" @click='showZy(item)'>
<i-col span="12" class="xy" :class="{'selectedColor':flag1==item.id}">
{{item.label}}
</i-col>
</i-row>
</tab-pane>
<tab-pane label="专业" name="zy" v-if="show2">
<i-row v-for="item in xyList.zy" @click="showList(item)">
<i-col span="12" class="xy" :class="{'selectedColor':flag2==item.id}">
{{item.label}}
</i-col>
</i-row>
</tab-pane>
</Tabs>
</div>
</Poptip>
</template>
<script>
export default {
data() {
return {
currentTab: 'xy',
show2: false,
flag1: -1,
flag2: -1,
xyList: [{
value: 'renwen',
id: 1,
label: '马克思主义学院',
zy: [{
value: 'xinxi',
id: 1,
label: '马克思'
},
{
value: 'gongcheng',
id: 2,
label: '马克思'
},
{
value: 'tongxin',
id: 3,
label: '马克思'
}
]
},
{
value: 'dili',
id: 2,
label: '地理信息科学技术学院',
zy: [{
value: 'xinxi',
id: 1,
label: '地理'
},
{
value: 'gongcheng',
id: 2,
label: '地理'
},
{
value: 'tongxin',
id: 3,
label: '地理'
}
]
},
{
value: 'sheke',
id: 3,
label: '社科',
zy: [{
value: 'xinxi',
id: 1,
label: '社科'
},
{
value: 'gongcheng',
id: 2,
label: '社科'
},
{
value: 'tongxin',
id: 3,
label: '社科'
}
]
},
{
value: 'renwen',
id: 4,
label: '人文',
zy: [{
value: 'xinxi',
id: 1,
label: '人文'
},
{
value: 'gongcheng',
id: 2,
label: '人文'
},
{
value: 'tongxin',
id: 3,
label: '人文'
}
]
},
{
value: 'dili',
id: 5,
label: '地理',
zy: [{
value: 'xinxi',
id: 1,
label: '地理'
},
{
value: 'gongcheng',
id: 2,
label: '地理'
},
{
value: 'tongxin',
id: 3,
label: '地理'
}
]
},
{
value: 'sheke',
id: 6,
label: '社科',
zy: [{
value: 'xinxi',
id: 1,
label: '社科'
},
{
value: 'gongcheng',
id: 2,
label: '社科'
},
{
value: 'tongxin',
id: 3,
label: '社科'
}
]
}
]
}
},
methods: {
currentTabChanged(name) {
if(this.currentTab == 'xy'){
// this.show2 = false
}
},
showZy(item) {
if (item.label) {
this.flag1 = item.id
this.xyList.zy = item.zy
this.show2 = true
this.currentTab = 'zy'
// console.log(this.xyList.zy)
}
},
showList(item) {
if (item.label) {
this.flag2 = item.id
// console.log(item.label)
}
}
}
}
</script> <style>
span {
padding: 10px;
cursor: pointer;
} .xy {
cursor: pointer;
padding: 5px;
box-sizing: border-box;
} .selectedColor {
color: #2d8cf0;
}
</style>
复制以上代码到 run ivew 网站预览效果
vue实现筛选功能,文字选中变色的更多相关文章
- vue 之 筛选功能实现
要实现的效果如下:根据输入框里面输入的内容筛选下面列表: 推荐实现代码如下:其中 allProductData 就是用来下拉列表的数据,allProductList 为从获取的所有列表的数据:
- 【PHP开源产品】Ecshop的商品筛选功能实现分析之一
一.首先,说明一下为什么要对category.php文件进行分析. 原因如下: ①个人对商城类商品筛选功能的实现比较好奇: ②对商城中关于商品的数据表设计比较感兴趣.(该功能涉及到与数据库的交互,而且 ...
- 织梦CMS实现多条件筛选功能
用织梦实现筛选的功能,其实主要就是运用到了织梦的高级搜索功能,然后用ajax去post替换掉本来的结果就可以了. 其实筛选的话,主要有两个问题需要解决,一个是前台的筛选实现,一个是后台根据前台的点击, ...
- js页面文字选中后分享到新浪微博实现
demo您可以狠狠地点击这里:js文字选中分享到新浪微博demo 方法与代码 选中即分享的功能看上去比较高级,其实实现是相当简单的.其中的会让人头大,一般人也不感兴趣的原理这里就直接跳过.这个js文字 ...
- 自适应 Tab 宽度可以滑动文字逐渐变色的 TabLayout(仿今日头条顶部导航)
TabLayout相信大家都用过,2015年Google大会上发布了新的Android Support Design库里面包含了很多新的控件,其中就包含TabLayout,它可以配合ViewPager ...
- 前端知识复习: JS选中变色
前端知识复习:JS选中变色 上篇文章 :前端知识复习:Html DIV 图文混排(文字放在图片下边) Js选中图片效果 <!DOCTYPE html> <html xmlns=&qu ...
- mxonline实战8,机构列表分页功能,以及按条件筛选功能
对应github地址:列表分页和按条件筛选 一. 列表分页 1. pip install django-pure-pagination 2. settings.py中 install ...
- 14、Django实战第14天:列表筛选功能
今天完成的是点击这些条件进行机构的筛选 首先来完成城市:当用户点击城市的时候,我们自动给它加一个参数(city.id) 编辑organization.views.py 刷新页面,发现筛选功能已经OK了 ...
- phpcms筛选功能
phpcms论坛的看到的-----做筛选功能-----自定义函数 <?php /** * extention.func.php 用户自定义函数库 * * @copyright (C) 2005- ...
随机推荐
- subprocess 模块
import subprocess # 就用来执行系统命令 import os cmd = r'dir D:\上海python全栈4期\day23 | findstr "py"' ...
- [luogu2446][bzoj2037][SDOI2008]Sue的小球【区间DP】
分析 简单区间DP, 定义状态f[i][j][0/1]为取完i-j的小球最后取i/j上的小球所能获得的最大价值. 排序转移. ac代码 #include <bits/stdc++.h> # ...
- css基本语法及页面引用
css基本语法 css的定义方法是: 选择器 { 属性:值; 属性:值; 属性:值;} 选择器是将样式和页面元素关联起来的名称,属性是希望设置的样式属性每个属性有一个或多个值.代码示例: div{ w ...
- 2018-2019 ACM-ICPC Pacific Northwest Regional Contest C Contest Setting(DP)
比赛链接:Contest Setting C题 题意:$n$道题目,每道题目难度为$ai$,选择$k$道难度不同的题目,有多少种选择方案.$1<=k<=n<=1000,1<=a ...
- bzoj3756pty的字符串(后缀自动机+计数)
题目描述 题解 我们可以先对trie树建出广义SAM,然后维护一下right集合大小(注意right集合在广义SAM上的维护方式). 然后把匹配穿往广义SAM上匹配,假设现在匹配到了x节点,那么x的所 ...
- Python学习day3 数据类型Ⅰ(str,int,bool)
day3 数据类型 @上节内容补充 每周一个思维导图-xmind.exe in / not in #示例:(是否包含敏感字符)while True: text = input('请输入你要说的 ...
- 51Nod--1076 2条不相交的路径(强连通分量)
电波 #include<bits/stdc++.h> using namespace std; #define LL long long #define maxn 30000 vector ...
- 编写高质量代码:改善Java程序的151个建议 --[98~105]
建议的采用顺序是List中泛型顺序依次为T.?.Object (1).List是确定的某一个类型 List表示的是List集合中的元素都为T类型,具体类型在运行期决定:List<?>表示的 ...
- JSF action actionListner 详解
https://stackoverflow.com/questions/3909267/differences-between-action-and-actionlistener actionLi ...
- 由AC自动机引发的灵感
一,WA自动机 #include <cstdio> using namespace std; int main() { printf("☺"); ; } 二,TLE自动 ...