-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[vue] 使用vue写一个tab切换 #453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
vue
vue
Comments
v-for循环list,根据索引值设置active的样式和显示内容 |
v-for循环,利用下标和v-show显示
|
作用域 插槽+子组件 |
<template>
<div class="tab-wrap">
<div class="tabs">
<button
v-for="i in list"
:key="i.id"
@click="choose = i.id"
>{{i.title}}</button>
</div>
<div class="content">{{list[choose].content}}</div>
</div>
</template>
<script>
export default {
data() {
return {
list: [
{id: 0, title: 'A', content: 'aaaaaaaaaaaaaa'},
{id: 1, title: 'B', content: 'bbbbbbbbbbbbbb'},
{id: 2, title: 'C', content: 'cccccccccccccc'}
],
choose: 0
}
}
}
</script> |
你们是怎么做到大部分的人的写法都相同的- - |
v-for循环数据在使用动态绑定类 {{itemCon}}
const vm=new Vue({ |
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[vue] 使用vue写一个tab切换
The text was updated successfully, but these errors were encountered: