Vue.js 条件 html 属性
Vue.js conditional html attribute
我有 Tab.vue
,我传递了一个选项卡数据对象(链接到 vue-router
)。我想在需要时传递 exact
,如果存在此属性,则将其附加到模板中
<tab :tabs="[{ text: 'Tab 1', route: 'home.tab1', exact: true }, { text: 'Tab 2', route: 'home.tab2' }]"></tab>
并在 Tab.vue
<router-link v-for="item in tabs" :to="{ name: item.route }" item.exact?>
{{ item.text }}
</router-link>
<router-link v-for="item in tabs" :to="{ name: item.route }" :exact="item.exact">
我有 Tab.vue
,我传递了一个选项卡数据对象(链接到 vue-router
)。我想在需要时传递 exact
,如果存在此属性,则将其附加到模板中
<tab :tabs="[{ text: 'Tab 1', route: 'home.tab1', exact: true }, { text: 'Tab 2', route: 'home.tab2' }]"></tab>
并在 Tab.vue
<router-link v-for="item in tabs" :to="{ name: item.route }" item.exact?>
{{ item.text }}
</router-link>
<router-link v-for="item in tabs" :to="{ name: item.route }" :exact="item.exact">