<divv-for="(router,index) in routers"v-bind:key="index":class="{active: index === activeIndex}"@click="selectItem(index)"><router-link :to="router.path"><veui-icon :name="router.meta.icon"/>{{router.meta.title}}</router-link></div>main.ts部分
export default class App extends Vue { @Provide() routers: Object = {} @Provide() activeIndex: number = 0; mounted() { this.routers = this.$router.options.routes; } selectItem(i: number) { this.activeIndex = i; }}思想:手动制造相等