Files
qiming/qiming-mobile/uni_modules/lime-tabs/components/l-tab-panel/l-tab-panel.uvue

56 lines
1.8 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="l-tab__panel" aria-role="tabpanel">
<slot/>
</view>
</template>
<script lang="uts" setup>
/**
* TabPanel 标签页面板组件
* @description 用于构建Tabs组件的单个内容面板必须作为Tabs的子组件使用
* <br>插件类型LTabPanelComponentPublicInstance
* @tutorial https://ext.dcloud.net.cn/plugin?name=lime-tabs
*
* @property {any} badge 徽标配置
* @property {number[]} offset 徽标位置偏移量[x,y]
* @property {boolean} dot 是否显示圆点徽标默认false
* @property {boolean} destroyOnHide 内容隐藏时销毁DOM默认false
* @property {boolean} disabled 禁用当前选项卡默认false
* @property {string} label 选项卡标题内容
* @property {boolean} lazy 启用懒加载默认false
* @property {number} value 选项卡唯一标识
*/
import { TabPanelProps } from './type';
import { TabPanel } from '../l-tabs/type'
const props = withDefaults(defineProps<TabPanelProps>(), {})
const children = inject<LTabPanelComponentPublicInstance[]|null>('LimeTabs', null) as Ref<LTabPanelComponentPublicInstance[]>|null;
const instance = getCurrentInstance()!.proxy!
onMounted(()=>{
if(children == null) return
children.value.push(instance as LTabPanelComponentPublicInstance)
})
// #ifdef APP-ANDROID
// 安卓端数组属性存在BUG 死循环
const innderOffset = ref<any[]>([])
watch((): any[]|null => props.offset, (n: any[]|null) => {
if(innderOffset.value.join('') == n?.join('')) return
innderOffset.value = n ?? []
}, {immediate: true})
defineExpose({
innderOffset
})
// #endif
onUnmounted(()=>{
if(children == null) return
children.value = children.value.filter((it):boolean => it != (instance))
})
</script>
<style lang="scss">
@import './index';
</style>