首页 > 技术文章 > vue找指定标签

hdg-caiqi 2018-04-24 17:10 原文

<script>
export default {
    data () {
        return {
            tody: TODAY,
            days: [/*数据在这里*/],
            activeIndex: null
        }
    },
    methods: {
        select (index) {
            this.activeIndex = index
        }
    }
}
</script>

<template>
<ul>
    <li v-for="(day, index) in days"
    @click="select(index)"
    :class="{active: index === activeIndex, today: day === today}">
    {{day}}
    </li>
</ul>
<template>

推荐阅读