1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <template>
- <view class="tabs">
- <view class="one" :style="{background:tabs.bgColor||'#f9f9f9'}">
- <scroll-view class="scrollView" scroll-x="true">
- <view class="list" v-for="(item,index) in tabs.menu" :key="index" :style="{background:tabs.active==item.active?tabs.acbgColor||'#ffffff':''}" @tap="tabsChange(index,item)">
- <text :style="{color:tabs.active==item.active?tabs.actxtColor||'#000000':tabs.txtColor||'#999999'}">{{item.title}}</text>
- </view>
- </scroll-view>
- </view>
- <slot></slot>
- </view>
- </template>
- <script>
- export default {
- props: {
- tabs: {
- type: Object,
- },
- },
- data() {
- return {};
- },
- methods: {
- tabsChange(index, item) {
- const that = this;
- that.$emit('tabsChange', item)
- }
- }
- }
- </script>
- <style lang="scss">
- .tabs {
- .one {
- padding: 2vw;
- .scrollView {
- display: flex;
- white-space: nowrap;
- text-align: center;
- }
- .list {
- display: inline-block;
- padding: 2vw;
- margin: 0 1.5vw;
- text-align: center;
- border-radius: 5px;
- text {
- font-weight: bold;
- font-size: 14px;
- }
- }
- }
- }
- </style>
|