| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 | | <template> |  |   <view class="nut-tab-pane" v-if="shouldBeRender" :style="paneStyle"> |  |     <slot></slot> |  |   </view> |  | </template> |  |   |  | <script setup lang="ts"> |  | import { CSSProperties, inject, ref, computed, watch } from 'vue'; |  |   |  | defineOptions({ |  |   name: 'ProTabPane', |  | }); |  |   |  | const props = defineProps({ |  |   title: { |  |     type: [String, Number], |  |     default: '', |  |   }, |  |   subTitle: { |  |     type: [String, Number], |  |     default: '', |  |   }, |  |   paneKey: { |  |     type: [String, Number], |  |     default: '', |  |   }, |  |   disabled: { |  |     type: Boolean, |  |     default: false, |  |   }, |  |   lazy: { |  |     type: Boolean, |  |     default: true, |  |   }, |  |   badgeValue: { |  |     type: Number, |  |     default: 0, |  |   }, |  | }); |  |   |  | const parentOption = inject('tabsOpiton') as any; |  |   |  | const paneStyle = computed(() => { |  |   return { |  |     display: |  |       parentOption.animatedTime.value === 0 && props.paneKey !== parentOption.activeKey.value |  |         ? 'none' |  |         : undefined, |  |   } as CSSProperties; |  | }); |  |   |  | const active = computed(() => props.paneKey === parentOption.activeKey.value); |  |   |  | const loaded = ref(active.value); |  |   |  | const shouldBeRender = computed(() => !props.lazy || loaded.value || active.value); |  |   |  | watch(active, (val) => { |  |   if (val) loaded.value = true; |  | }); |  | </script> | 
 |