Skip to content

Commit

Permalink
refactor(tabs): lazyLoad rename lazy (#3481)
Browse files Browse the repository at this point in the history
* refactor(Tabs): lazyLoad rename lazy

* chore: _common update

* docs: example update
  • Loading branch information
liweijie0812 authored Oct 16, 2023
1 parent 3cccc72 commit a26eea0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/_common
6 changes: 3 additions & 3 deletions src/tabs/_example/lazy-load.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<t-space direction="vertical" size="large">
<t-tabs v-model="value">
<t-tab-panel :value="1" label="选项卡1" :destroy-on-hide="true" :lazy-load="true">
<t-tab-panel :value="1" label="选项卡1" :destroy-on-hide="true" :lazy="true">
<p style="padding: 25px">选项卡1的内容,隐藏会销毁</p>
</t-tab-panel>
<t-tab-panel :value="2" label="选项卡2" :lazy-load="true">
<t-tab-panel :value="2" label="选项卡2" :lazy="true">
<template #panel>
<p style="padding: 25px">选项卡2的内容,隐藏不会销毁</p>
</template>
</t-tab-panel>
<t-tab-panel :value="3" label="选项卡3" :panel="panelRender" :destroy-on-hide="true" :lazy-load="true" />
<t-tab-panel :value="3" label="选项卡3" :panel="panelRender" :destroy-on-hide="true" :lazy="true" />
</t-tabs>
</t-space>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/tab-panel-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
type: [String, Function] as PropType<TdTabPanelProps['label']>,
},
/** 是否启用选项卡懒加载 */
lazyLoad: Boolean,
lazy: Boolean,
/** 用于自定义选项卡面板内容 */
panel: {
type: [String, Function] as PropType<TdTabPanelProps['panel']>,
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/tab-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default defineComponent({

const tabs = inject<InjectTabs>('tabs');
const isActive = computed(() => props.value === tabs.value.value);
const isMount = ref(props.lazyLoad ? isActive.value : true);
const isMount = ref(props.lazy ? isActive.value : true);

watch(isActive, () => {
if (isActive.value) {
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/tabs.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ destroyOnHide | Boolean | false | \- | N
disabled | Boolean | false | \- | N
draggable | Boolean | true | \- | N
label | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
lazyLoad | Boolean | false | Enable tab lazy loading | N
lazy | Boolean | false | Enable tab lazy loading | N
panel | String / Slot / Function | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
removable | Boolean | false | \- | N
value | String / Number | - | Typescript:`TabValue` | N
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ destroyOnHide | Boolean | false | 选项卡内容隐藏时是否销毁 | N
disabled | Boolean | false | 是否禁用当前选项卡 | N
draggable | Boolean | true | 选项卡组件开启允许拖动排序时,当前选项卡是否允许拖动 | N
label | String / Slot / Function | - | 选项卡名称,可自定义选项卡导航内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
lazyLoad | Boolean | false | 是否启用选项卡懒加载 | N
lazy | Boolean | false | 是否启用选项卡懒加载 | N
panel | String / Slot / Function | - | 用于自定义选项卡面板内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
removable | Boolean | false | 当前选项卡是否允许移除 | N
value | String / Number | - | 选项卡的值,唯一标识。TS 类型:`TabValue` | N
Expand Down
2 changes: 1 addition & 1 deletion src/tabs/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export interface TdTabPanelProps {
* 是否启用选项卡懒加载
* @default false
*/
lazyLoad?: boolean;
lazy?: boolean;
/**
* 用于自定义选项卡面板内容
*/
Expand Down

0 comments on commit a26eea0

Please sign in to comment.