uview-pro 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +29 -0
- package/components/u-action-sheet/types.ts +2 -0
- package/components/u-action-sheet/u-action-sheet.vue +15 -4
- package/components/u-alert-tips/types.ts +2 -0
- package/components/u-alert-tips/u-alert-tips.vue +24 -9
- package/components/u-avatar/types.ts +2 -0
- package/components/u-avatar/u-avatar.vue +15 -5
- package/components/u-avatar-cropper/u-avatar-cropper.vue +13 -2
- package/components/u-back-top/types.ts +2 -5
- package/components/u-back-top/u-back-top.vue +27 -15
- package/components/u-badge/types.ts +2 -0
- package/components/u-badge/u-badge.vue +33 -15
- package/components/u-button/types.ts +2 -2
- package/components/u-button/u-button.vue +23 -10
- package/components/u-car-keyboard/types.ts +2 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +14 -5
- package/components/u-card/types.ts +2 -0
- package/components/u-card/u-card.vue +25 -10
- package/components/u-cell-group/types.ts +2 -0
- package/components/u-cell-group/u-cell-group.vue +15 -5
- package/components/u-cell-item/types.ts +2 -0
- package/components/u-cell-item/u-cell-item.vue +24 -11
- package/components/u-checkbox/types.ts +2 -0
- package/components/u-checkbox/u-checkbox.vue +12 -13
- package/components/u-checkbox-group/types.ts +2 -0
- package/components/u-checkbox-group/u-checkbox-group.vue +1 -1
- package/components/u-circle-progress/types.ts +2 -0
- package/components/u-circle-progress/u-circle-progress.vue +24 -9
- package/components/u-city-select/types.ts +2 -0
- package/components/u-city-select/u-city-select.vue +16 -4
- package/components/u-col/types.ts +2 -0
- package/components/u-col/u-col.vue +27 -8
- package/components/u-collapse/u-collapse.vue +8 -4
- package/components/u-collapse-item/u-collapse-item.vue +32 -27
- package/components/u-column-notice/types.ts +2 -0
- package/components/u-column-notice/u-column-notice.vue +16 -4
- package/components/u-count-down/types.ts +2 -0
- package/components/u-count-down/u-count-down.vue +20 -8
- package/components/u-count-to/types.ts +2 -0
- package/components/u-count-to/u-count-to.vue +25 -7
- package/components/u-divider/types.ts +2 -0
- package/components/u-divider/u-divider.vue +26 -10
- package/components/u-dropdown/types.ts +2 -0
- package/components/u-dropdown/u-dropdown.vue +48 -20
- package/components/u-dropdown-item/types.ts +2 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +33 -41
- package/components/u-empty/types.ts +2 -0
- package/components/u-empty/u-empty.vue +20 -5
- package/components/u-field/types.ts +2 -0
- package/components/u-field/u-field.vue +18 -3
- package/components/u-form/types.ts +2 -0
- package/components/u-form/u-form.vue +20 -26
- package/components/u-form-item/types.ts +2 -0
- package/components/u-form-item/u-form-item.vue +67 -67
- package/components/u-full-screen/types.ts +2 -0
- package/components/u-full-screen/u-full-screen.vue +16 -2
- package/components/u-gap/types.ts +2 -0
- package/components/u-gap/u-gap.vue +15 -5
- package/components/u-grid/types.ts +2 -0
- package/components/u-grid/u-grid.vue +23 -25
- package/components/u-grid-item/types.ts +3 -3
- package/components/u-grid-item/u-grid-item.vue +43 -47
- package/components/u-icon/types.ts +0 -1
- package/components/u-icon/u-icon.vue +5 -3
- package/components/u-image/u-image.vue +13 -4
- package/components/u-index-anchor/types.ts +3 -3
- package/components/u-index-anchor/u-index-anchor.vue +18 -10
- package/components/u-index-list/u-index-list.vue +9 -12
- package/components/u-input/types.ts +2 -5
- package/components/u-input/u-input.vue +15 -6
- package/components/u-keyboard/u-keyboard.vue +13 -4
- package/components/u-lazy-load/u-lazy-load.vue +13 -2
- package/components/u-line/u-line.vue +13 -4
- package/components/u-line-progress/u-line-progress.vue +13 -4
- package/components/u-link/u-link.vue +13 -4
- package/components/u-loading/u-loading.vue +13 -4
- package/components/u-loading-popup/u-loading-popup.vue +14 -0
- package/components/u-loadmore/u-loadmore.vue +13 -2
- package/components/u-mask/types.ts +2 -5
- package/components/u-mask/u-mask.vue +21 -14
- package/components/u-message-input/u-message-input.vue +13 -2
- package/components/u-modal/u-modal.vue +13 -4
- package/components/u-navbar/u-navbar.vue +13 -2
- package/components/u-no-network/u-no-network.vue +13 -2
- package/components/u-notice-bar/u-notice-bar.vue +13 -3
- package/components/u-number-box/u-number-box.vue +13 -4
- package/components/u-number-keyboard/u-number-keyboard.vue +13 -4
- package/components/u-picker/u-picker.vue +13 -4
- package/components/u-popup/types.ts +2 -2
- package/components/u-popup/u-popup.vue +15 -5
- package/components/u-radio/types.ts +2 -0
- package/components/u-radio/u-radio.vue +26 -19
- package/components/u-radio-group/types.ts +2 -0
- package/components/u-radio-group/u-radio-group.vue +20 -32
- package/components/u-rate/types.ts +2 -0
- package/components/u-rate/u-rate.vue +20 -5
- package/components/u-read-more/types.ts +2 -0
- package/components/u-read-more/u-read-more.vue +23 -7
- package/components/u-root-portal/u-root-portal.vue +3 -1
- package/components/u-row/types.ts +2 -0
- package/components/u-row/u-row.vue +29 -11
- package/components/u-row-notice/types.ts +2 -0
- package/components/u-row-notice/u-row-notice.vue +16 -4
- package/components/u-safe-bottom/u-safe-bottom.vue +13 -2
- package/components/u-search/types.ts +2 -0
- package/components/u-search/u-search.vue +16 -5
- package/components/u-section/types.ts +2 -0
- package/components/u-section/u-section.vue +31 -12
- package/components/u-select/types.ts +2 -0
- package/components/u-select/u-select.vue +15 -5
- package/components/u-skeleton/types.ts +2 -0
- package/components/u-skeleton/u-skeleton.vue +14 -3
- package/components/u-slider/types.ts +2 -0
- package/components/u-slider/u-slider.vue +27 -19
- package/components/u-status-bar/u-status-bar.vue +13 -4
- package/components/u-steps/types.ts +2 -0
- package/components/u-steps/u-steps.vue +15 -3
- package/components/u-sticky/types.ts +2 -0
- package/components/u-sticky/u-sticky.vue +23 -7
- package/components/u-subsection/types.ts +2 -0
- package/components/u-subsection/u-subsection.vue +14 -3
- package/components/u-swipe-action/types.ts +2 -0
- package/components/u-swipe-action/u-swipe-action.vue +19 -3
- package/components/u-swiper/types.ts +2 -0
- package/components/u-swiper/u-swiper.vue +19 -2
- package/components/u-switch/types.ts +2 -0
- package/components/u-switch/u-switch.vue +15 -6
- package/components/u-tabbar/types.ts +2 -0
- package/components/u-tabbar/u-tabbar.vue +20 -3
- package/components/u-table/types.ts +2 -0
- package/components/u-table/u-table.vue +15 -3
- package/components/u-tabs/types.ts +2 -0
- package/components/u-tabs/u-tabs.vue +14 -3
- package/components/u-tabs-swiper/types.ts +2 -0
- package/components/u-tabs-swiper/u-tabs-swiper.vue +15 -3
- package/components/u-tag/types.ts +2 -0
- package/components/u-tag/u-tag.vue +22 -6
- package/components/u-td/types.ts +2 -0
- package/components/u-td/u-td.vue +14 -3
- package/components/u-text/u-text.vue +4 -2
- package/components/u-th/types.ts +2 -0
- package/components/u-th/u-th.vue +14 -3
- package/components/u-time-line/u-time-line.vue +17 -3
- package/components/u-time-line-item/types.ts +2 -0
- package/components/u-time-line-item/u-time-line-item.vue +15 -3
- package/components/u-toast/types.ts +2 -0
- package/components/u-toast/u-toast.vue +15 -8
- package/components/u-top-tips/types.ts +2 -0
- package/components/u-top-tips/u-top-tips.vue +20 -3
- package/components/u-tr/types.ts +4 -1
- package/components/u-tr/u-tr.vue +17 -2
- package/components/u-upload/types.ts +2 -0
- package/components/u-upload/u-upload.vue +14 -5
- package/components/u-verification-code/types.ts +2 -0
- package/components/u-verification-code/u-verification-code.vue +15 -3
- package/components/u-waterfall/types.ts +2 -0
- package/components/u-waterfall/u-waterfall.vue +15 -3
- package/libs/hooks/index.ts +2 -1
- package/libs/hooks/useCompRelation.ts +364 -0
- package/libs/index.ts +56 -39
- package/package.json +1 -1
- package/readme.md +6 -6
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
<view
|
|
3
3
|
@tap="onClick"
|
|
4
4
|
class="u-cell"
|
|
5
|
-
:class="
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
:class="[
|
|
6
|
+
{
|
|
7
|
+
'u-border-bottom': borderBottom,
|
|
8
|
+
'u-border-top': borderTop,
|
|
9
|
+
'u-col-center': center,
|
|
10
|
+
'u-cell--required': required
|
|
11
|
+
},
|
|
12
|
+
customClass
|
|
13
|
+
]"
|
|
11
14
|
hover-stay-time="150"
|
|
12
15
|
:hover-class="hoverClass"
|
|
13
|
-
:style="{ backgroundColor: bgColor }"
|
|
16
|
+
:style="$u.toStyle({ backgroundColor: bgColor }, customStyle)"
|
|
14
17
|
>
|
|
15
18
|
<u-icon
|
|
16
19
|
:size="iconSize"
|
|
@@ -46,13 +49,23 @@
|
|
|
46
49
|
</view>
|
|
47
50
|
</template>
|
|
48
51
|
|
|
52
|
+
<script lang="ts">
|
|
53
|
+
export default {
|
|
54
|
+
name: 'u-cell-item',
|
|
55
|
+
options: {
|
|
56
|
+
addGlobalClass: true,
|
|
57
|
+
// #ifndef MP-TOUTIAO
|
|
58
|
+
virtualHost: true,
|
|
59
|
+
// #endif
|
|
60
|
+
styleIsolation: 'shared'
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
64
|
+
|
|
49
65
|
<script setup lang="ts">
|
|
50
66
|
import { computed, useSlots } from 'vue';
|
|
51
67
|
import { CellItemProps } from './types';
|
|
52
|
-
|
|
53
|
-
defineOptions({
|
|
54
|
-
name: 'u-cell-item'
|
|
55
|
-
});
|
|
68
|
+
import { $u } from '../..';
|
|
56
69
|
|
|
57
70
|
/**
|
|
58
71
|
* cellItem 单元格Item
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import type { Shape } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* checkbox 复选框类型定义
|
|
@@ -8,6 +9,7 @@ import type { Shape } from '../../types/global';
|
|
|
8
9
|
export type CheckboxValue = string | number | boolean;
|
|
9
10
|
|
|
10
11
|
export const CheckboxProps = {
|
|
12
|
+
...baseProps,
|
|
11
13
|
/** checkbox的名称 */
|
|
12
14
|
name: { type: [String, Number], default: '' },
|
|
13
15
|
/** 形状,square为方形,circle为原型 */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-checkbox" :style="
|
|
2
|
+
<view class="u-checkbox" :style="$u.toStyle(checkboxStyle, customStyle)" :class="customClass">
|
|
3
3
|
<view class="u-checkbox__icon-wrap" @tap="toggle" :class="iconClass" :style="$u.toStyle(iconStyle)">
|
|
4
4
|
<u-icon
|
|
5
5
|
class="u-checkbox__icon-wrap__icon"
|
|
@@ -35,7 +35,7 @@ export default {
|
|
|
35
35
|
|
|
36
36
|
<script setup lang="ts">
|
|
37
37
|
import { computed } from 'vue';
|
|
38
|
-
import { $u, useChildren
|
|
38
|
+
import { $u, useChildren } from '../..';
|
|
39
39
|
import { CheckboxProps } from './types';
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -57,7 +57,7 @@ const props = defineProps(CheckboxProps);
|
|
|
57
57
|
const emit = defineEmits(['change', 'update:modelValue']);
|
|
58
58
|
|
|
59
59
|
// 使用子组件Hook
|
|
60
|
-
const {
|
|
60
|
+
const { parentExposed } = useChildren('u-checkbox', 'u-checkbox-group');
|
|
61
61
|
|
|
62
62
|
// 是否禁用,如果父组件u-checkbox-group禁用的话,将会忽略子组件的配置
|
|
63
63
|
const isDisabled = computed(() => {
|
|
@@ -188,24 +188,23 @@ function setValue() {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
emitEvent();
|
|
198
|
-
}
|
|
191
|
+
// 设置组件的modelValue值
|
|
192
|
+
function setChecked(data: any) {
|
|
193
|
+
if (!isDisabled.value) {
|
|
194
|
+
emit('update:modelValue', data.checked);
|
|
195
|
+
if (data.checked !== props.modelValue) {
|
|
196
|
+
emitEvent();
|
|
199
197
|
}
|
|
200
198
|
}
|
|
201
|
-
}
|
|
199
|
+
}
|
|
202
200
|
|
|
203
201
|
defineExpose({
|
|
204
202
|
isChecked: computed(() => props.modelValue),
|
|
205
203
|
name: props.name,
|
|
206
204
|
setValue,
|
|
207
205
|
emitEvent,
|
|
208
|
-
props
|
|
206
|
+
props,
|
|
207
|
+
setChecked
|
|
209
208
|
});
|
|
210
209
|
</script>
|
|
211
210
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import type { Shape } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* checkbox-group 复选框组类型定义
|
|
@@ -7,6 +8,7 @@ import type { Shape } from '../../types/global';
|
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
export const CheckboxGroupProps = {
|
|
11
|
+
...baseProps,
|
|
10
12
|
/** 最多能选中多少个checkbox */
|
|
11
13
|
max: { type: Number, default: 999 },
|
|
12
14
|
/** 是否禁用所有复选框 */
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { type ExtractPropTypes, type PropType } from 'vue';
|
|
2
2
|
import type { ThemeType } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* circleProgress 环形进度条 Props
|
|
6
7
|
* @description 展示操作或任务的当前进度,比如上传文件,是一个圆形的进度条。注意:此组件的percent值只能动态增加,不能动态减少。
|
|
7
8
|
*/
|
|
8
9
|
export const CircleProgressProps = {
|
|
10
|
+
...baseProps,
|
|
9
11
|
/** 圆环进度百分比值 */
|
|
10
12
|
percent: {
|
|
11
13
|
type: Number,
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="u-circle-progress"
|
|
4
|
-
:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
:class="customClass"
|
|
5
|
+
:style="
|
|
6
|
+
$u.toStyle(
|
|
7
|
+
{
|
|
8
|
+
width: widthPx + 'px',
|
|
9
|
+
height: widthPx + 'px',
|
|
10
|
+
backgroundColor: bgColor
|
|
11
|
+
},
|
|
12
|
+
customStyle
|
|
13
|
+
)
|
|
14
|
+
"
|
|
9
15
|
>
|
|
10
16
|
<!-- 支付宝小程序不支持canvas-id属性,必须用id属性 -->
|
|
11
17
|
<canvas
|
|
@@ -30,15 +36,24 @@
|
|
|
30
36
|
</view>
|
|
31
37
|
</template>
|
|
32
38
|
|
|
39
|
+
<script lang="ts">
|
|
40
|
+
export default {
|
|
41
|
+
name: 'u-circle-progress',
|
|
42
|
+
options: {
|
|
43
|
+
addGlobalClass: true,
|
|
44
|
+
// #ifndef MP-TOUTIAO
|
|
45
|
+
virtualHost: true,
|
|
46
|
+
// #endif
|
|
47
|
+
styleIsolation: 'shared'
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
</script>
|
|
51
|
+
|
|
33
52
|
<script setup lang="ts">
|
|
34
53
|
import { ref, computed, watch, onMounted, getCurrentInstance } from 'vue';
|
|
35
54
|
import { $u } from '../..';
|
|
36
55
|
import { CircleProgressProps } from './types';
|
|
37
56
|
|
|
38
|
-
defineOptions({
|
|
39
|
-
name: 'u-circle-progress'
|
|
40
|
-
});
|
|
41
|
-
|
|
42
57
|
/**
|
|
43
58
|
* circleProgress 环形进度条
|
|
44
59
|
* @description 展示操作或任务的当前进度,比如上传文件,是一个圆形的进度条。注意:此组件的percent值只能动态增加,不能动态减少。
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* u-city-select 城市选择器 Props
|
|
5
6
|
* @description 用于选择省、市、区三级行政区域,支持回显和自定义初始值。
|
|
6
7
|
*/
|
|
7
8
|
export const CitySelectProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 控制弹窗显示与隐藏(v-model) */
|
|
9
11
|
modelValue: { type: Boolean, default: false },
|
|
10
12
|
/** 默认选中的省市区名称数组 */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<u-popup
|
|
3
3
|
v-model="popupValue"
|
|
4
|
+
:class="customClass"
|
|
5
|
+
:style="$u.toStyle(customStyle)"
|
|
4
6
|
mode="bottom"
|
|
5
7
|
:popup="false"
|
|
6
8
|
:mask="true"
|
|
@@ -89,16 +91,26 @@
|
|
|
89
91
|
</u-popup>
|
|
90
92
|
</template>
|
|
91
93
|
|
|
94
|
+
<script lang="ts">
|
|
95
|
+
export default {
|
|
96
|
+
name: 'u-city-select',
|
|
97
|
+
options: {
|
|
98
|
+
addGlobalClass: true,
|
|
99
|
+
// #ifndef MP-TOUTIAO
|
|
100
|
+
virtualHost: true,
|
|
101
|
+
// #endif
|
|
102
|
+
styleIsolation: 'shared'
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
</script>
|
|
106
|
+
|
|
92
107
|
<script setup lang="ts">
|
|
93
108
|
import { ref, computed, onMounted } from 'vue';
|
|
94
109
|
import provinces from '../../libs/util/province';
|
|
95
110
|
import citysData from '../../libs/util/city';
|
|
96
111
|
import areasData from '../../libs/util/area';
|
|
97
112
|
import { CitySelectProps } from './types';
|
|
98
|
-
|
|
99
|
-
defineOptions({
|
|
100
|
-
name: 'u-city-select'
|
|
101
|
-
});
|
|
113
|
+
import { $u } from '../..';
|
|
102
114
|
|
|
103
115
|
/**
|
|
104
116
|
* u-city-select 城市选择器
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { AlignType, JustifyType } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* u-col 布局单元格 Props
|
|
@@ -13,6 +14,7 @@ import type { AlignType, JustifyType } from '../../types/global';
|
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
export const ColProps = {
|
|
17
|
+
...baseProps,
|
|
16
18
|
/** 占父容器宽度的多少等分,总分为12份 */
|
|
17
19
|
span: { type: [Number, String] as PropType<number | string>, default: 12 },
|
|
18
20
|
/** 指定栅格左侧的间隔数(总12栏) */
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
class="u-col"
|
|
4
|
+
:class="['u-col-' + span, customClass]"
|
|
5
|
+
:style="$u.toStyle(colStyle, customStyle)"
|
|
6
|
+
@tap="onClick"
|
|
7
|
+
>
|
|
3
8
|
<slot></slot>
|
|
4
9
|
</view>
|
|
5
10
|
</template>
|
|
6
11
|
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
export default {
|
|
14
|
+
name: 'u-col',
|
|
15
|
+
options: {
|
|
16
|
+
addGlobalClass: true,
|
|
17
|
+
// #ifndef MP-TOUTIAO
|
|
18
|
+
virtualHost: true,
|
|
19
|
+
// #endif
|
|
20
|
+
styleIsolation: 'shared'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
7
25
|
<script setup lang="ts">
|
|
8
|
-
import { computed
|
|
26
|
+
import { computed } from 'vue';
|
|
9
27
|
import { ColProps } from './types';
|
|
10
|
-
|
|
11
|
-
defineOptions({
|
|
12
|
-
name: 'u-col'
|
|
13
|
-
});
|
|
28
|
+
import { $u, useChildren } from '../../';
|
|
14
29
|
|
|
15
30
|
/**
|
|
16
31
|
* col 布局单元格
|
|
@@ -26,10 +41,14 @@ const emit = defineEmits<{ (e: 'click'): void }>();
|
|
|
26
41
|
|
|
27
42
|
const props = defineProps(ColProps);
|
|
28
43
|
|
|
44
|
+
const { parentExposed } = useChildren('u-col', 'u-row');
|
|
45
|
+
|
|
29
46
|
/**
|
|
30
47
|
* gutter 给col添加间距,左右边距各占一半,从父组件u-row获取
|
|
31
48
|
*/
|
|
32
|
-
const gutter =
|
|
49
|
+
const gutter = computed(() => {
|
|
50
|
+
return parentExposed?.value?.props?.gutter ?? 20;
|
|
51
|
+
});
|
|
33
52
|
|
|
34
53
|
/**
|
|
35
54
|
* 计算水平排列方式
|
|
@@ -55,7 +74,7 @@ const uAlignItem = computed(() => {
|
|
|
55
74
|
* 计算样式对象
|
|
56
75
|
*/
|
|
57
76
|
const colStyle = computed<any>(() => ({
|
|
58
|
-
padding: `0 ${Number(gutter) / 2}
|
|
77
|
+
padding: `0 ${Number(gutter.value) / 2}px`,
|
|
59
78
|
marginLeft: `${(100 / 12) * Number(props.offset)}%`,
|
|
60
79
|
flex: `0 0 ${(100 / 12) * Number(props.span)}%`,
|
|
61
80
|
alignItems: uAlignItem.value,
|
|
@@ -92,13 +92,17 @@ function onChange(name: string | number) {
|
|
|
92
92
|
// 收集当前所有展开的项
|
|
93
93
|
let currentActiveNames: (string | number)[] = [];
|
|
94
94
|
if (props.accordion) {
|
|
95
|
-
currentActiveNames = activeName.value ? [activeName.value] : [];
|
|
95
|
+
currentActiveNames = activeName.value === 0 || activeName.value ? [activeName.value] : [];
|
|
96
96
|
} else {
|
|
97
|
-
//
|
|
97
|
+
// 对于非手风琴模式,我们不知道所有项的状态
|
|
98
98
|
currentActiveNames = [];
|
|
99
|
+
children.forEach(child => {
|
|
100
|
+
if (child.getExposed().isShow.value) {
|
|
101
|
+
currentActiveNames.push(child.getExposed().itemName);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
99
104
|
}
|
|
100
|
-
|
|
101
|
-
emit('change', props.accordion ? activeName.value || '' : currentActiveNames);
|
|
105
|
+
currentActiveNames.length > 0 && emit('change', props.accordion ? activeName.value || '' : currentActiveNames);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-collapse-item" :style="
|
|
2
|
+
<view class="u-collapse-item" :style="$u.toStyle(itemStyle, customStyle)" :class="customClass">
|
|
3
3
|
<view
|
|
4
4
|
:hover-stay-time="200"
|
|
5
5
|
class="u-collapse-head"
|
|
@@ -42,7 +42,7 @@ export default {
|
|
|
42
42
|
|
|
43
43
|
<script setup lang="ts">
|
|
44
44
|
import { ref, watch, onMounted, useSlots, getCurrentInstance, nextTick, computed } from 'vue';
|
|
45
|
-
import { $u, useChildren
|
|
45
|
+
import { $u, useChildren } from '../..';
|
|
46
46
|
import { CollapseItemProps } from './types';
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -148,11 +148,8 @@ function init() {
|
|
|
148
148
|
*/
|
|
149
149
|
function headClick() {
|
|
150
150
|
if (props.disabled) return;
|
|
151
|
-
|
|
152
151
|
// 通知父组件状态变化
|
|
153
|
-
|
|
154
|
-
parentExposed.value.onChange(itemName.value);
|
|
155
|
-
}
|
|
152
|
+
parentExposed?.value?.onChange(itemName.value);
|
|
156
153
|
}
|
|
157
154
|
|
|
158
155
|
/**
|
|
@@ -176,27 +173,31 @@ function queryRect() {
|
|
|
176
173
|
});
|
|
177
174
|
}
|
|
178
175
|
|
|
179
|
-
//
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
176
|
+
// 单选
|
|
177
|
+
function openSingle(data: any) {
|
|
178
|
+
// 只有目标项展开,其他都关闭
|
|
179
|
+
const shouldShow = data.targetName === itemName.value;
|
|
180
|
+
setShowState(shouldShow);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// 关闭所有
|
|
184
|
+
function closeAll() {
|
|
185
|
+
setShowState(false);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// 多选
|
|
189
|
+
function setMultiple(data: any) {
|
|
190
|
+
const shouldShow = data.targetNames.includes(itemName.value);
|
|
191
|
+
setShowState(shouldShow);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// 切换单个
|
|
195
|
+
function toggleSingle(data: any) {
|
|
196
|
+
// 只有目标项才切换状态
|
|
197
|
+
if (data.targetName === itemName.value) {
|
|
198
|
+
setShowState(!isShow.value);
|
|
198
199
|
}
|
|
199
|
-
}
|
|
200
|
+
}
|
|
200
201
|
|
|
201
202
|
onMounted(() => {
|
|
202
203
|
// 关键修复:根据 open 属性设置初始状态
|
|
@@ -236,7 +237,11 @@ defineExpose({
|
|
|
236
237
|
hoverClass,
|
|
237
238
|
itemName: itemName.value,
|
|
238
239
|
queryRect,
|
|
239
|
-
setShowState
|
|
240
|
+
setShowState,
|
|
241
|
+
openSingle,
|
|
242
|
+
closeAll,
|
|
243
|
+
setMultiple,
|
|
244
|
+
toggleSingle
|
|
240
245
|
});
|
|
241
246
|
</script>
|
|
242
247
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { Direction, PlayState, ScrollDirection, ThemeType } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* u-column-notice 通告栏 Props
|
|
6
7
|
*/
|
|
7
8
|
export const ColumnNoticeProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 显示的内容,数组 */
|
|
9
11
|
list: { type: Array as PropType<string[]>, default: () => [] },
|
|
10
12
|
/** 显示的主题,success|error|primary|info|warning */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="u-notice-bar"
|
|
4
|
-
:style="{ background: computeBgColor, padding: props.padding }"
|
|
5
|
-
:class="[props.type ? `u-type-${props.type}-light-bg` : '']"
|
|
4
|
+
:style="$u.toStyle({ background: computeBgColor, padding: props.padding }, customStyle)"
|
|
5
|
+
:class="[props.type ? `u-type-${props.type}-light-bg` : '', customClass]"
|
|
6
6
|
>
|
|
7
7
|
<view class="u-icon-wrap">
|
|
8
8
|
<u-icon
|
|
@@ -54,11 +54,23 @@
|
|
|
54
54
|
</view>
|
|
55
55
|
</template>
|
|
56
56
|
|
|
57
|
+
<script lang="ts">
|
|
58
|
+
export default {
|
|
59
|
+
name: 'u-column-notice',
|
|
60
|
+
options: {
|
|
61
|
+
addGlobalClass: true,
|
|
62
|
+
// #ifndef MP-TOUTIAO
|
|
63
|
+
virtualHost: true,
|
|
64
|
+
// #endif
|
|
65
|
+
styleIsolation: 'shared'
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
</script>
|
|
69
|
+
|
|
57
70
|
<script setup lang="ts">
|
|
58
71
|
import { computed } from 'vue';
|
|
59
72
|
import { ColumnNoticeProps } from './types';
|
|
60
|
-
|
|
61
|
-
defineOptions({ name: 'u-column-notice' });
|
|
73
|
+
import { $u } from '../../';
|
|
62
74
|
|
|
63
75
|
/**
|
|
64
76
|
* u-column-notice 通告栏
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* u-count-down 倒计时 Props
|
|
5
6
|
* @description 该组件一般使用于某个活动的截止时间上,通过数字的变化,给用户明确的时间感受,提示用户进行某一个行为操作。
|
|
6
7
|
*/
|
|
7
8
|
export const CountDownProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 倒计时的时间,秒为单位 */
|
|
9
11
|
timestamp: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
10
12
|
/** 是否自动开始倒计时 */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-countdown">
|
|
2
|
+
<view class="u-countdown" :class="customClass" :style="$u.toStyle(customStyle)">
|
|
3
3
|
<view
|
|
4
4
|
class="u-countdown-item"
|
|
5
|
-
:style="
|
|
5
|
+
:style="$u.toStyle(itemStyle)"
|
|
6
6
|
v-if="props.showDays && (props.hideZeroDay || (!props.hideZeroDay && d != '00'))"
|
|
7
7
|
>
|
|
8
|
-
<view class="u-countdown-time" :style="
|
|
8
|
+
<view class="u-countdown-time" :style="$u.toStyle(letterStyle)">
|
|
9
9
|
{{ d }}
|
|
10
10
|
</view>
|
|
11
11
|
</view>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
>
|
|
21
21
|
{{ props.separator == 'colon' && props.showHours ? ':' : '天' }}
|
|
22
22
|
</view>
|
|
23
|
-
<view class="u-countdown-item" :style="
|
|
23
|
+
<view class="u-countdown-item" :style="$u.toStyle(itemStyle)" v-if="props.showHours">
|
|
24
24
|
<view class="u-countdown-time" :style="{ fontSize: props.fontSize + 'rpx', color: props.color }">
|
|
25
25
|
{{ h }}
|
|
26
26
|
</view>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
>
|
|
37
37
|
{{ props.separator == 'colon' && props.showMinutes ? ':' : '时' }}
|
|
38
38
|
</view>
|
|
39
|
-
<view class="u-countdown-item" :style="
|
|
39
|
+
<view class="u-countdown-item" :style="$u.toStyle(itemStyle)" v-if="props.showMinutes">
|
|
40
40
|
<view class="u-countdown-time" :style="{ fontSize: props.fontSize + 'rpx', color: props.color }">
|
|
41
41
|
{{ i }}
|
|
42
42
|
</view>
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
>
|
|
53
53
|
{{ props.separator == 'colon' && props.showSeconds ? ':' : '分' }}
|
|
54
54
|
</view>
|
|
55
|
-
<view class="u-countdown-item" :style="
|
|
55
|
+
<view class="u-countdown-item" :style="$u.toStyle(itemStyle)" v-if="props.showSeconds">
|
|
56
56
|
<view class="u-countdown-time" :style="{ fontSize: props.fontSize + 'rpx', color: props.color }">
|
|
57
57
|
{{ s }}
|
|
58
58
|
</view>
|
|
@@ -67,11 +67,23 @@
|
|
|
67
67
|
</view>
|
|
68
68
|
</template>
|
|
69
69
|
|
|
70
|
+
<script lang="ts">
|
|
71
|
+
export default {
|
|
72
|
+
name: 'u-count-down',
|
|
73
|
+
options: {
|
|
74
|
+
addGlobalClass: true,
|
|
75
|
+
// #ifndef MP-TOUTIAO
|
|
76
|
+
virtualHost: true,
|
|
77
|
+
// #endif
|
|
78
|
+
styleIsolation: 'shared'
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
</script>
|
|
82
|
+
|
|
70
83
|
<script setup lang="ts">
|
|
71
84
|
import { ref, computed, watch, onMounted } from 'vue';
|
|
72
85
|
import { CountDownProps } from './types';
|
|
73
|
-
|
|
74
|
-
defineOptions({ name: 'u-count-down' });
|
|
86
|
+
import { $u } from '../../';
|
|
75
87
|
|
|
76
88
|
/**
|
|
77
89
|
* countDown 倒计时
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* u-count-to 数字滚动 Props
|
|
5
6
|
* @description 该组件一般用于需要滚动数字到某一个值的场景,目标要求是一个递增的值。
|
|
6
7
|
*/
|
|
7
8
|
export const CountToProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 开始的数值,默认从0增长到某一个数 */
|
|
9
11
|
startVal: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
10
12
|
/** 要滚动的目标数值,必须 */
|
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="u-count-num"
|
|
4
|
-
:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
:class="customClass"
|
|
5
|
+
:style="
|
|
6
|
+
$u.toStyle(
|
|
7
|
+
{
|
|
8
|
+
fontSize: props.fontSize + 'rpx',
|
|
9
|
+
fontWeight: props.bold ? 'bold' : 'normal',
|
|
10
|
+
color: props.color
|
|
11
|
+
},
|
|
12
|
+
customStyle
|
|
13
|
+
)
|
|
14
|
+
"
|
|
9
15
|
>
|
|
10
16
|
{{ displayValue }}
|
|
11
17
|
</view>
|
|
12
18
|
</template>
|
|
13
19
|
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
export default {
|
|
22
|
+
name: 'u-count-to',
|
|
23
|
+
options: {
|
|
24
|
+
addGlobalClass: true,
|
|
25
|
+
// #ifndef MP-TOUTIAO
|
|
26
|
+
virtualHost: true,
|
|
27
|
+
// #endif
|
|
28
|
+
styleIsolation: 'shared'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
</script>
|
|
32
|
+
|
|
14
33
|
<script setup lang="ts">
|
|
15
34
|
import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
|
|
16
35
|
import { CountToProps } from './types';
|
|
17
|
-
|
|
18
|
-
defineOptions({ name: 'u-count-to' });
|
|
36
|
+
import { $u } from '../../';
|
|
19
37
|
|
|
20
38
|
/**
|
|
21
39
|
* countTo 数字滚动
|