@Wangww0925
2019-08-07T05:46:31.000000Z
字数 1062
阅读 263
vue-cli
:class="{'active':item.active}"@click="checkFun(item)"that.active ? this.$set(that,'active',false) : this.$set(that,'active',true);
<template><div><div class="w check"><p :class="{'active':item.active}" v-for="item in checkList" @click="checkFun(item)"><i></i>{{item.name}}</p></div></div></template><script>export default {data () {return {checkList: [{ name: 'Css'},{ name: 'Css预处理器' },{ name: 'HTML' },{ name: 'JavaScript' },{ name: '模板' },{ name: '框架' },{ name: 'Vue' },{ name: '杂谈' },{ name: '性能' },{ name: '基础' },{ name: '基础' },{ name: '基础' },{ name: '基础' },]}},methods: {checkFun(that){that.active ? this.$set(that,'active',false) : this.$set(that,'active',true);}}}</script><style scoped lang="stylus">pwidth:100%;line-height:30px;width:auto;display: inline-block;margin:0px 15px 0px 0px;cursor:pointer;iwidth:14px;height:14px;border:1px solid #ddd;margin-right:8px;vertical-align:-3px;border-radius:3px;p.activecolor:#81D841;iborder-color: #81D841;background-color: #81D841;background-repeat: no-repeat;background-position: center center;background-size: contain;</style>
作者 wendy
2018 年 1月 9日
