vue点击变色
<template>
<div>
<router-link to="/w1">点击回去</router-link> <div v-for="(x,index) in list" v-bind:class="{red:isred===index}" @click="change(index)">
{{x.id}}-{{x.title}}-{{x.author}}
</div>
</div>
</template> <script>
export default {
name: 'News',
data () {
return {
list:[{id:1,title:"娱乐新闻",author:"小李"},
{id:2,title:"军事新闻",author:"小王"},
{id:3,title:"财经新闻",author:"小张"},],
isred:-1
}
},
methods: {
change:function(index){
this.isred=index
}
}
}
</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.red{
background-color: red;
}
</style>
vue点击变色的更多相关文章
- vue点击元素变色兄弟元素不变色
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- android 自定义控件——(五)按钮点击变色
----------------------------------按钮点击变色(源代码下有属性解释)------------------------------------------------- ...
- vue 点击当前元素添加class 去掉兄弟的class 获取当前点击元素的文字
点击当前标签给其添加class,兄弟标签class删除 然后获取当前点击元素的文字 演示地址: https://xibushijie.github.io/static/addClass.html &l ...
- (网页)angular中实现li或者某个元素点击变色的两种方法(转)
转自脚本之家: 本篇文章主要介绍了angular中实现li或者某个元素点击变色的两种方法,非常具有实用价值,需要的朋友可以参考下 本文介绍了angular中实现li或者某个元素点击变色的两种方法,分享 ...
- vue点击返回顶部插件vue-totop
vue-totop vue 点击返回顶部插件,可以根据参数设定按钮大小,颜色,类型,返回顶部的时间等.github地址:https://github.com/1006008051/vue-totop, ...
- vue点击切换颜色限制个数(用了mui框架)
vue点击切换颜色 只能点击一个 <!doctype html> <head> <meta charset="UTF-8"> <title ...
- vue 点击当前元素添加class 去掉兄弟的class
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http ...
- jquery 与javascript关系 ①取元素 ②操作内容 ③操作属性 ④操作 样式 ⑤ 事件 点击变色
jQuery的min版本和原版功能是一样的,min版主要应用于已经开发成的网页中,而非min版 的文件比较大,里面有整洁的代码书写规范和注释,主要应用于脚本开发过程当中. JQuery是继protot ...
- Android实现按钮点击效果(第一次点击变色,第二次恢复)
1.首先创建一个按钮 <Button android:id="@+id/click" android:layout_width="fill_parent" ...
随机推荐
- leetcode1042 Flower Planting With No Adjacent
""" You have N gardens, labelled 1 to N. In each garden, you want to plant one of 4 t ...
- python基础数据类型--集合(set)
python基础数据类型--集合(set) 集合是一个数学概念由一个或多个确定的元素所构成的整体叫做集合 集合中的三个特征 1.确定性(元素必须死可hash) 2.互异性(去重) 3.无序性(集合中的 ...
- Android studio 中出现fail to load platform rendering library
解决方法: 1)将布局的API接口改为低版本的(如蓝色箭头所示) 2)改为真机测试
- 小技巧:使用命令行打开vscode 以及 sublime 工具
vscode手动打开vscode command + shift + p 打开命令面板(或者点击菜单栏 查看>命令面板)输入 shell 选择 install code command in P ...
- POJ 3916:Duplicate Removal 将相近的重复元素删除
Duplicate Removal Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1745 Accepted: 1213 ...
- git仓库拆分
例如: # 这就是那个大仓库 big-project $ git clone git@github.com:tom/big-project.git $ cd big-project # 把所有 `co ...
- 第四篇:Vue的项目开发
安装Vue的脚手架cli环境 1)官网下载并安装node,附带npm https://nodejs.org/zh-cn/ node环境: 可以解释执行js语言 提供了npm应用商城,可以为node环境 ...
- Bug 佛祖镇楼
原文链接:https://www.cnblogs.com/xdp-gacl/p/4198935.html // _ooOoo_ // o8888888o // 88" . "88 ...
- Swift泛型定义 同时限定T的类(class)和多协议(protocol)
https://blog.csdn.net/weixin_34054931/article/details/88027728 swift 可以定义模板函数,如: func testFunc<T& ...
- bmp
function GetNumberBuffer(cZi: string; cwidth, cheight: Integer; FontName: string; bold, italic: Bool ...