Browse Source

组件tab增加插槽

ming 3 years ago
parent
commit
6acb231443
1 changed files with 2 additions and 2 deletions
  1. 2 2
      components/fs-tab/fs-tab.vue

+ 2 - 2
components/fs-tab/fs-tab.vue

@@ -18,7 +18,7 @@
 					v-for="(item, index) in tabs"
 					:key="index"
 					@click="setActive(index)">
-						{{item.name}}
+						<slot :item="item" :index="index">{{item.name}}</slot>
 						<view 
 							v-if="type === 'line' && index == curIndex" 
 							class="fs-tab-item-bar" 
@@ -79,7 +79,7 @@ const props = defineProps({
 const emits = defineEmits(['change', 'update:modelValue'])
 
 const scrollable = computed(() => props.scrollThreshold <= props.tabs.length)
-const itemStyle = computed(() => scrollable.value ? `flex: 0 0 ${88 / props.scrollThreshold}%;` : '1')
+const itemStyle = computed(() => scrollable.value ? `flex: 0 0 ${88 / props.scrollThreshold}%;` : '')
 const curIndex = computed(() => props.modelValue)
 
 const setActive = index => {