复现源码 - chenxi-20/cjm-tiny-vue GitHub Wiki
<script lang="ts" setup>
import { Button as TinyButton, Grid as TinyGrid, GridColumn as TinyGridColumn, Tabs as TinyTabs, TabItem as TinyTabItem } from '@opentiny/vue';
import { ref, computed } from 'vue';
const url = ref('ecs');
const changeUrl = () => {
if (url.value === 'ecs') {
url.value = 'bms';
} else {
url.value = 'ecs';
}
};
const activeTab = ref('');
const tabList1 = [
{ name: 'listCalc', id: 'tab-listCalc', label: '价格计算器', type: 'ListCalc', customName: '' },
{
name: 'cart',
id: 'tab-cart',
label: '价格清单',
type: 'Cart',
customName: '价格清单0: ¥0.00 ',
},
];
const tabList2 = [
{ name: 'detail', id: 'tab-detail', label: '价格详情', type: 'Detail', customName: '' },
{ name: 'calc', id: 'tab-calc', label: '价格计算器', type: 'Calc', customName: '' },
{
name: 'cart',
id: 'tab-cart',
label: '价格清单',
type: 'Cart',
customName: '价格清单0: ¥0.00 ',
},
];
const currentTabList = computed(() => {
if (!activeTab.value) {
activeTab.value = url.value === 'ecs' ? 'calc' : 'listCalc';
}
// activeTab.value = url.value === 'ecs' ? 'calc' : 'listCalc';
return url.value === 'ecs' ? tabList2 : tabList1;
});
</script>