uview-pro 0.2.3 → 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 +52 -0
- package/components/u-action-sheet/types.ts +2 -0
- package/components/u-action-sheet/u-action-sheet.vue +25 -7
- package/components/u-alert-tips/types.ts +2 -0
- package/components/u-alert-tips/u-alert-tips.vue +36 -10
- package/components/u-avatar/types.ts +2 -0
- package/components/u-avatar/u-avatar.vue +31 -7
- package/components/u-avatar-cropper/u-avatar-cropper.vue +13 -2
- package/components/u-avatar-cropper/weCropper.js +36 -8
- package/components/u-avatar-cropper/weCropper.ts +28 -7
- package/components/u-back-top/types.ts +2 -5
- package/components/u-back-top/u-back-top.vue +31 -16
- 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 +34 -11
- package/components/u-calendar/types.ts +3 -1
- package/components/u-calendar/u-calendar.vue +172 -17
- package/components/u-car-keyboard/types.ts +2 -0
- package/components/u-car-keyboard/u-car-keyboard.vue +36 -8
- 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 +37 -13
- package/components/u-checkbox/types.ts +2 -0
- package/components/u-checkbox/u-checkbox.vue +9 -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 +30 -11
- package/components/u-city-select/types.ts +2 -0
- package/components/u-city-select/u-city-select.vue +48 -8
- 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 -13
- package/components/u-collapse-item/u-collapse-item.vue +21 -42
- package/components/u-column-notice/types.ts +2 -0
- package/components/u-column-notice/u-column-notice.vue +54 -8
- package/components/u-count-down/types.ts +2 -0
- package/components/u-count-down/u-count-down.vue +39 -11
- package/components/u-count-to/types.ts +2 -0
- package/components/u-count-to/u-count-to.vue +34 -9
- package/components/u-divider/types.ts +2 -0
- package/components/u-divider/u-divider.vue +36 -12
- package/components/u-dropdown/types.ts +2 -0
- package/components/u-dropdown/u-dropdown.vue +64 -23
- package/components/u-dropdown-item/types.ts +2 -0
- package/components/u-dropdown-item/u-dropdown-item.vue +39 -42
- 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 +41 -7
- package/components/u-form/types.ts +2 -0
- package/components/u-form/u-form.vue +25 -27
- package/components/u-form-item/types.ts +2 -0
- package/components/u-form-item/u-form-item.vue +104 -74
- package/components/u-full-screen/types.ts +2 -0
- package/components/u-full-screen/u-full-screen.vue +24 -3
- 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 -43
- package/components/u-icon/types.ts +0 -1
- package/components/u-icon/u-icon.vue +20 -5
- package/components/u-image/u-image.vue +23 -6
- 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 +34 -10
- package/components/u-keyboard/u-keyboard.vue +26 -6
- package/components/u-lazy-load/u-lazy-load.vue +23 -10
- package/components/u-line/u-line.vue +13 -4
- package/components/u-line-progress/u-line-progress.vue +22 -5
- package/components/u-link/u-link.vue +13 -4
- package/components/u-loading/u-loading.vue +20 -5
- package/components/u-loading-popup/u-loading-popup.vue +14 -0
- package/components/u-loadmore/u-loadmore.vue +19 -3
- 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 +32 -6
- package/components/u-modal/u-modal.vue +21 -5
- package/components/u-navbar/u-navbar.vue +31 -6
- package/components/u-no-network/u-no-network.vue +16 -3
- package/components/u-notice-bar/u-notice-bar.vue +19 -4
- package/components/u-number-box/u-number-box.vue +13 -4
- package/components/u-number-keyboard/u-number-keyboard.vue +32 -10
- package/components/u-picker/u-picker.vue +62 -14
- package/components/u-popup/types.ts +2 -2
- package/components/u-popup/u-popup.vue +33 -7
- package/components/u-radio/types.ts +2 -0
- package/components/u-radio/u-radio.vue +45 -24
- package/components/u-radio-group/types.ts +2 -0
- package/components/u-radio-group/u-radio-group.vue +20 -22
- 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 +30 -8
- 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 +51 -8
- 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 +30 -7
- package/components/u-section/types.ts +2 -0
- package/components/u-section/u-section.vue +38 -13
- package/components/u-select/types.ts +2 -0
- package/components/u-select/u-select.vue +37 -10
- package/components/u-skeleton/types.ts +2 -0
- package/components/u-skeleton/u-skeleton.vue +32 -6
- package/components/u-slider/types.ts +2 -0
- package/components/u-slider/u-slider.vue +38 -21
- 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 +26 -5
- package/components/u-sticky/types.ts +2 -0
- package/components/u-sticky/u-sticky.vue +27 -8
- 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 +27 -4
- package/components/u-swiper/types.ts +2 -0
- package/components/u-swiper/u-swiper.vue +50 -8
- package/components/u-switch/types.ts +2 -0
- package/components/u-switch/u-switch.vue +19 -5
- package/components/u-tabbar/types.ts +2 -0
- package/components/u-tabbar/u-tabbar.vue +42 -7
- 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 +22 -4
- package/components/u-tabs-swiper/types.ts +2 -0
- package/components/u-tabs-swiper/u-tabs-swiper.vue +36 -6
- package/components/u-tag/types.ts +2 -0
- package/components/u-tag/u-tag.vue +31 -7
- package/components/u-td/types.ts +2 -0
- package/components/u-td/u-td.vue +14 -3
- package/components/u-text/types.ts +4 -1
- package/components/u-text/u-text.vue +22 -5
- 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 +10 -2
- package/components/u-upload/u-upload.vue +31 -8
- 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/iconfont.css +2 -1
- package/libs/css/style.vue.scss +1 -1
- package/libs/function/$parent.ts +4 -1
- package/libs/function/colorGradient.ts +18 -4
- package/libs/function/deepMerge.ts +2 -1
- package/libs/function/getParent.ts +5 -1
- package/libs/function/md5.ts +17 -5
- package/libs/function/queryParams.ts +5 -1
- package/libs/function/test.ts +7 -3
- package/libs/function/timeFormat.ts +2 -1
- package/libs/function/type2icon.ts +4 -1
- package/libs/hooks/index.ts +2 -1
- package/libs/hooks/useCompRelation.ts +364 -0
- package/libs/hooks/useComponent.ts +485 -69
- package/libs/hooks/useEmitter.ts +4 -2
- package/libs/index.ts +56 -39
- package/libs/request/index.ts +24 -5
- package/libs/util/async-validator.d.ts +16 -3
- package/libs/util/emitter.ts +12 -2
- package/libs/util/mitt.ts +4 -1
- package/package.json +1 -1
- package/readme.md +6 -6
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-tabs" :style="{ zIndex: zIndex, background: bgColor }">
|
|
3
|
-
<scroll-view
|
|
2
|
+
<view class="u-tabs" :style="$u.toStyle({ zIndex: zIndex, background: bgColor }, customStyle)" :class="customClass">
|
|
3
|
+
<scroll-view
|
|
4
|
+
scroll-x
|
|
5
|
+
class="u-scroll-view"
|
|
6
|
+
:scroll-left="scrollLeft"
|
|
7
|
+
scroll-with-animation
|
|
8
|
+
:style="{ zIndex: Number(zIndex) + 1 }"
|
|
9
|
+
>
|
|
4
10
|
<view class="u-tabs-scroll-box" :class="{ 'u-tabs-scroll-flex': !isScroll }">
|
|
5
|
-
<view
|
|
11
|
+
<view
|
|
12
|
+
class="u-tabs-item"
|
|
13
|
+
:style="tabItemStyle(index)"
|
|
14
|
+
v-for="(item, index) in getTabs"
|
|
15
|
+
:key="index"
|
|
16
|
+
:class="[preId + index]"
|
|
17
|
+
@tap="emitTabChange(index)"
|
|
18
|
+
>
|
|
6
19
|
<u-badge :count="item[count] || item['count'] || 0" :offset="offset" size="mini"></u-badge>
|
|
7
20
|
{{ item[name] || item['name'] }}
|
|
8
21
|
</view>
|
|
@@ -12,12 +25,24 @@
|
|
|
12
25
|
</view>
|
|
13
26
|
</template>
|
|
14
27
|
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
export default {
|
|
30
|
+
name: 'u-tabs-swiper',
|
|
31
|
+
options: {
|
|
32
|
+
addGlobalClass: true,
|
|
33
|
+
// #ifndef MP-TOUTIAO
|
|
34
|
+
virtualHost: true,
|
|
35
|
+
// #endif
|
|
36
|
+
styleIsolation: 'shared'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
</script>
|
|
40
|
+
|
|
15
41
|
<script setup lang="ts">
|
|
16
42
|
import { ref, computed, watch, nextTick, onMounted, getCurrentInstance } from 'vue';
|
|
17
43
|
import colorGradient from '../../libs/function/colorGradient';
|
|
18
44
|
import { TabsSwiperProps } from './types';
|
|
19
|
-
|
|
20
|
-
defineOptions({ name: 'u-tabs-swiper' });
|
|
45
|
+
import { $u } from '../..';
|
|
21
46
|
|
|
22
47
|
/**
|
|
23
48
|
* tabsSwiper 全屏选项卡
|
|
@@ -96,7 +121,12 @@ function tabItemStyle(index: number) {
|
|
|
96
121
|
height: props.height + 'rpx',
|
|
97
122
|
lineHeight: props.height + 'rpx',
|
|
98
123
|
padding: `0 ${Number(props.gutter) / 2}rpx`,
|
|
99
|
-
color:
|
|
124
|
+
color:
|
|
125
|
+
tabsInfo.value.length > 0
|
|
126
|
+
? tabsInfo.value[index]
|
|
127
|
+
? tabsInfo.value[index].color
|
|
128
|
+
: props.activeColor
|
|
129
|
+
: props.inactiveColor,
|
|
100
130
|
fontSize: props.fontSize + 'rpx',
|
|
101
131
|
zIndex: Number(props.zIndex) + 2,
|
|
102
132
|
fontWeight: index == getCurrent.value && props.bold ? 'bold' : 'normal'
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { TagShape, TagMode, TagSize, ThemeType } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* TagProps tag props 类型定义
|
|
6
7
|
* @description 标签组件,支持多种类型、尺寸、形状、可关闭等
|
|
7
8
|
*/
|
|
8
9
|
export const TagProps = {
|
|
10
|
+
...baseProps,
|
|
9
11
|
/** 类型,primary、success、info、warning、error */
|
|
10
12
|
type: { type: String as PropType<ThemeType>, default: 'primary' },
|
|
11
13
|
/** 是否禁用 */
|
|
@@ -1,25 +1,49 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
v-if="show"
|
|
4
|
-
:class="[
|
|
4
|
+
:class="[
|
|
5
|
+
disabled ? 'u-disabled' : '',
|
|
6
|
+
'u-size-' + size,
|
|
7
|
+
'u-shape-' + shape,
|
|
8
|
+
'u-mode-' + mode + '-' + type,
|
|
9
|
+
customClass
|
|
10
|
+
]"
|
|
5
11
|
class="u-tag"
|
|
6
|
-
:style="
|
|
12
|
+
:style="$u.toStyle(customStyle)"
|
|
7
13
|
@tap="clickTag"
|
|
8
14
|
>
|
|
9
15
|
{{ text }}
|
|
10
16
|
<view class="u-icon-wrap" @tap.stop>
|
|
11
|
-
<u-icon
|
|
17
|
+
<u-icon
|
|
18
|
+
@click="close"
|
|
19
|
+
size="22"
|
|
20
|
+
v-if="closeable"
|
|
21
|
+
:color="closeIconColor"
|
|
22
|
+
name="close"
|
|
23
|
+
class="u-close-icon"
|
|
24
|
+
:style="[iconStyle]"
|
|
25
|
+
></u-icon>
|
|
12
26
|
</view>
|
|
13
27
|
</view>
|
|
14
28
|
</template>
|
|
15
29
|
|
|
30
|
+
<script lang="ts">
|
|
31
|
+
export default {
|
|
32
|
+
name: 'u-tag',
|
|
33
|
+
options: {
|
|
34
|
+
addGlobalClass: true,
|
|
35
|
+
// #ifndef MP-TOUTIAO
|
|
36
|
+
virtualHost: true,
|
|
37
|
+
// #endif
|
|
38
|
+
styleIsolation: 'shared'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
16
43
|
<script setup lang="ts">
|
|
17
44
|
import { computed } from 'vue';
|
|
18
45
|
import { TagProps } from './types';
|
|
19
|
-
|
|
20
|
-
defineOptions({
|
|
21
|
-
name: 'u-tag'
|
|
22
|
-
});
|
|
46
|
+
import { $u } from '../../';
|
|
23
47
|
|
|
24
48
|
/**
|
|
25
49
|
* tag 提示
|
package/components/u-td/types.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* TdProps td props 类型定义
|
|
5
6
|
* @description 表格单元格组件,支持宽度自定义
|
|
6
7
|
*/
|
|
7
8
|
export const TdProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 宽度,百分比或者具体带单位的值,如30%, 200rpx等,一般使用百分比 */
|
|
9
11
|
width: { type: [Number, String] as PropType<number | string>, default: 'auto' }
|
|
10
12
|
};
|
package/components/u-td/u-td.vue
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-td" :style="tdStyle">
|
|
2
|
+
<view class="u-td" :style="$u.toStyle(tdStyle, customStyle)" :class="customClass">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
export default {
|
|
9
|
+
name: 'u-td',
|
|
10
|
+
options: {
|
|
11
|
+
addGlobalClass: true,
|
|
12
|
+
// #ifndef MP-TOUTIAO
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
// #endif
|
|
15
|
+
styleIsolation: 'shared'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
7
20
|
<script setup lang="ts">
|
|
8
21
|
import { ref, onMounted, getCurrentInstance, watch } from 'vue';
|
|
9
22
|
import { $u } from '../..';
|
|
10
23
|
import { TdProps } from './types';
|
|
11
24
|
|
|
12
|
-
defineOptions({ name: 'u-td' });
|
|
13
|
-
|
|
14
25
|
/**
|
|
15
26
|
* td td单元格
|
|
16
27
|
* @description 表格组件一般用于展示大量结构化数据的场景(搭配u-table使用)
|
|
@@ -35,7 +35,10 @@ export const TextProps = {
|
|
|
35
35
|
/** 字体大小 */
|
|
36
36
|
size: { type: [String, Number] as PropType<string | number>, default: 28 },
|
|
37
37
|
/** 图标样式 */
|
|
38
|
-
iconStyle: {
|
|
38
|
+
iconStyle: {
|
|
39
|
+
type: [Object, String] as PropType<Record<string, any> | string>,
|
|
40
|
+
default: () => ({ fontSize: '15px' })
|
|
41
|
+
},
|
|
39
42
|
/** 文字样式 */
|
|
40
43
|
textStyle: { type: [Object, String] as PropType<Record<string, any> | string>, default: () => ({}) },
|
|
41
44
|
/** 文字装饰 */
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
`u-text--align-${props.align}`,
|
|
10
10
|
customClass
|
|
11
11
|
]"
|
|
12
|
-
:style="textStyle"
|
|
12
|
+
:style="$u.toStyle(textStyle, customStyle)"
|
|
13
13
|
@click="onClick"
|
|
14
14
|
>
|
|
15
15
|
<!-- prefixIcon -->
|
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
<u-icon :name="props.prefixIcon" :custom-style="$u.toStyle(props.iconStyle)"></u-icon>
|
|
18
18
|
</view>
|
|
19
19
|
<!-- 价格模式 -->
|
|
20
|
-
<text
|
|
20
|
+
<text
|
|
21
|
+
v-if="props.mode === 'price'"
|
|
22
|
+
:class="['u-text__price', props.type && `u-text__value--${props.type}`]"
|
|
23
|
+
:style="textValueStyle"
|
|
24
|
+
>
|
|
25
|
+
¥{{ displayValue }}
|
|
26
|
+
</text>
|
|
21
27
|
<!-- link 模式 -->
|
|
22
28
|
<u-link v-else-if="props.mode === 'link'" :href="props.href" underLine>{{ displayValue }}</u-link>
|
|
23
29
|
<template v-else-if="props.openType && isMp">
|
|
@@ -44,7 +50,12 @@
|
|
|
44
50
|
</button>
|
|
45
51
|
</template>
|
|
46
52
|
<!-- 默认模式 -->
|
|
47
|
-
<text
|
|
53
|
+
<text
|
|
54
|
+
v-else
|
|
55
|
+
class="u-text__value"
|
|
56
|
+
:style="textValueStyle"
|
|
57
|
+
:class="[props.type && `u-text__value--${props.type}`, props.lines ? `u-line-${props.lines}` : '']"
|
|
58
|
+
>
|
|
48
59
|
{{ displayValue }}
|
|
49
60
|
</text>
|
|
50
61
|
<!-- 后缀图标 -->
|
|
@@ -59,7 +70,9 @@ export default {
|
|
|
59
70
|
name: 'u-text',
|
|
60
71
|
options: {
|
|
61
72
|
addGlobalClass: true,
|
|
73
|
+
// #ifndef MP-TOUTIAO
|
|
62
74
|
virtualHost: true,
|
|
75
|
+
// #endif
|
|
63
76
|
styleIsolation: 'shared'
|
|
64
77
|
}
|
|
65
78
|
};
|
|
@@ -184,7 +197,11 @@ const textValueStyle = computed(() => {
|
|
|
184
197
|
fontWeight: props.bold ? 'bold' : 'normal',
|
|
185
198
|
wordWrap: props.wordWrap,
|
|
186
199
|
fontSize: $u.addUnit(props.size),
|
|
187
|
-
lineHeight: props.lineHeight
|
|
200
|
+
lineHeight: props.lineHeight
|
|
201
|
+
? typeof props.lineHeight === 'number'
|
|
202
|
+
? `${props.lineHeight}px`
|
|
203
|
+
: props.lineHeight
|
|
204
|
+
: undefined
|
|
188
205
|
};
|
|
189
206
|
if (props.lines) {
|
|
190
207
|
style['display'] = '-webkit-box';
|
|
@@ -200,7 +217,7 @@ const textValueStyle = computed(() => {
|
|
|
200
217
|
return $u.toStyle($u.deepMerge(style, props.textStyle as Record<string, any>));
|
|
201
218
|
}
|
|
202
219
|
if ($u.test.string(props.textStyle)) {
|
|
203
|
-
return
|
|
220
|
+
return $u.toStyle(style, props.textStyle);
|
|
204
221
|
}
|
|
205
222
|
return $u.toStyle(style);
|
|
206
223
|
});
|
package/components/u-th/types.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* ThProps th props 类型定义
|
|
5
6
|
* @description 表格表头单元格组件,支持宽度自定义
|
|
6
7
|
*/
|
|
7
8
|
export const ThProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 宽度,百分比或者具体带单位的值,如30%, 200rpx等,一般使用百分比 */
|
|
9
11
|
width: { type: [Number, String] as PropType<number | string>, default: 'auto' }
|
|
10
12
|
};
|
package/components/u-th/u-th.vue
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-th" :style="thStyle">
|
|
2
|
+
<view class="u-th" :style="$u.toStyle(thStyle, customStyle)" :class="customClass">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
export default {
|
|
9
|
+
name: 'u-th',
|
|
10
|
+
options: {
|
|
11
|
+
addGlobalClass: true,
|
|
12
|
+
// #ifndef MP-TOUTIAO
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
// #endif
|
|
15
|
+
styleIsolation: 'shared'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
7
20
|
<script setup lang="ts">
|
|
8
21
|
import { ref, onMounted, getCurrentInstance, watch } from 'vue';
|
|
9
22
|
import { $u } from '../..';
|
|
10
23
|
import { ThProps } from './types';
|
|
11
24
|
|
|
12
|
-
defineOptions({ name: 'u-th' });
|
|
13
|
-
|
|
14
25
|
/**
|
|
15
26
|
* th th单元格
|
|
16
27
|
* @description 表格组件一般用于展示大量结构化数据的场景(搭配u-table使用)
|
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-time-axis">
|
|
2
|
+
<view class="u-time-axis" :class="customClass" :style="$u.toStyle(customStyle)">
|
|
3
3
|
<slot />
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
export default {
|
|
9
|
+
name: 'u-time-line',
|
|
10
|
+
options: {
|
|
11
|
+
addGlobalClass: true,
|
|
12
|
+
// #ifndef MP-TOUTIAO
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
// #endif
|
|
15
|
+
styleIsolation: 'shared'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
7
20
|
<script setup lang="ts">
|
|
8
|
-
|
|
21
|
+
import { baseProps } from '../common/props';
|
|
22
|
+
import { $u } from '../../';
|
|
9
23
|
|
|
10
24
|
/**
|
|
11
25
|
* timeLine 时间轴
|
|
@@ -14,7 +28,7 @@ defineOptions({ name: 'u-time-line' });
|
|
|
14
28
|
* @example <u-time-line></u-time-line>
|
|
15
29
|
*/
|
|
16
30
|
|
|
17
|
-
|
|
31
|
+
const props = defineProps({ ...baseProps });
|
|
18
32
|
</script>
|
|
19
33
|
|
|
20
34
|
<style lang="scss" scoped>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* TimeLineItemProps 时间轴节点 props 类型定义
|
|
5
6
|
* @description 时间轴节点组件,支持自定义节点颜色、位置
|
|
6
7
|
*/
|
|
7
8
|
export const TimeLineItemProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 节点的背景颜色 */
|
|
9
11
|
bgColor: { type: String, default: '#ffffff' },
|
|
10
12
|
/** 节点左边图标绝对定位的top值,单位rpx */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-time-axis-item">
|
|
2
|
+
<view class="u-time-axis-item" :class="customClass" :style="$u.toStyle(customStyle)">
|
|
3
3
|
<slot name="content" />
|
|
4
4
|
<view class="u-time-axis-node" :style="[nodeStyle]">
|
|
5
5
|
<slot name="node">
|
|
@@ -9,11 +9,23 @@
|
|
|
9
9
|
</view>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
+
<script lang="ts">
|
|
13
|
+
export default {
|
|
14
|
+
name: 'u-time-line-item',
|
|
15
|
+
options: {
|
|
16
|
+
addGlobalClass: true,
|
|
17
|
+
// #ifndef MP-TOUTIAO
|
|
18
|
+
virtualHost: true,
|
|
19
|
+
// #endif
|
|
20
|
+
styleIsolation: 'shared'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
</script>
|
|
24
|
+
|
|
12
25
|
<script setup lang="ts">
|
|
13
26
|
import { computed } from 'vue';
|
|
14
27
|
import { TimeLineItemProps } from './types';
|
|
15
|
-
|
|
16
|
-
defineOptions({ name: 'u-time-line-item' });
|
|
28
|
+
import { $u } from '../../';
|
|
17
29
|
|
|
18
30
|
/**
|
|
19
31
|
* timeLineItem 时间轴Item
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { ThemeType, ToastPosition } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* ToastProps toast props 类型定义
|
|
6
7
|
* @description 消息提示组件,支持 z-index 及多种配置项
|
|
7
8
|
*/
|
|
8
9
|
export const ToastProps = {
|
|
10
|
+
...baseProps,
|
|
9
11
|
/** 层级 z-index */
|
|
10
12
|
zIndex: { type: [Number, String] as PropType<number | string>, default: '' },
|
|
11
13
|
/** 提示类型,success/warning/error/loading 等 */
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view
|
|
3
3
|
class="u-toast"
|
|
4
|
-
:class="[isShow ? 'u-show' : '', 'u-type-' + tmpConfig.type, 'u-position-' + tmpConfig.position]"
|
|
5
|
-
:style="{
|
|
6
|
-
zIndex: uZIndex
|
|
7
|
-
}"
|
|
4
|
+
:class="[isShow ? 'u-show' : '', 'u-type-' + tmpConfig.type, 'u-position-' + tmpConfig.position, customClass]"
|
|
5
|
+
:style="$u.toStyle({ zIndex: uZIndex }, customStyle)"
|
|
8
6
|
>
|
|
9
7
|
<view class="u-icon-wrap">
|
|
10
8
|
<u-icon v-if="tmpConfig.icon" class="u-icon" :name="iconName" :size="30" :color="tmpConfig.type"></u-icon>
|
|
@@ -13,16 +11,25 @@
|
|
|
13
11
|
</view>
|
|
14
12
|
</template>
|
|
15
13
|
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
export default {
|
|
16
|
+
name: 'u-toast',
|
|
17
|
+
options: {
|
|
18
|
+
addGlobalClass: true,
|
|
19
|
+
// #ifndef MP-TOUTIAO
|
|
20
|
+
virtualHost: true,
|
|
21
|
+
// #endif
|
|
22
|
+
styleIsolation: 'shared'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
</script>
|
|
26
|
+
|
|
16
27
|
<script setup lang="ts">
|
|
17
28
|
import { ref, computed } from 'vue';
|
|
18
29
|
import { $u } from '../..';
|
|
19
30
|
import type { ToastExpose } from './types';
|
|
20
31
|
import { ToastProps } from './types';
|
|
21
32
|
|
|
22
|
-
defineOptions({
|
|
23
|
-
name: 'u-toast'
|
|
24
|
-
});
|
|
25
|
-
|
|
26
33
|
/**
|
|
27
34
|
* toast 消息提示
|
|
28
35
|
* @description 此组件表现形式类似uni的uni.showToastAPI,但也有不同的地方。
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* TopTipsProps top-tips props 类型定义
|
|
5
6
|
* @description 顶部提示组件,支持导航栏高度、z-index
|
|
6
7
|
*/
|
|
7
8
|
export const TopTipsProps = {
|
|
9
|
+
...baseProps,
|
|
8
10
|
/** 导航栏高度,用于提示的初始化 */
|
|
9
11
|
navbarHeight: { type: [Number, String] as PropType<number | string>, default: 0 },
|
|
10
12
|
/** z-index值 */
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
class="u-tips"
|
|
4
|
+
:class="['u-' + type, isShow ? 'u-tip-show' : '', customClass]"
|
|
5
|
+
:style="$u.toStyle(tipStyle, customStyle)"
|
|
6
|
+
>
|
|
7
|
+
{{ title }}
|
|
8
|
+
</view>
|
|
3
9
|
</template>
|
|
4
10
|
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
export default {
|
|
13
|
+
name: 'u-top-tips',
|
|
14
|
+
options: {
|
|
15
|
+
addGlobalClass: true,
|
|
16
|
+
// #ifndef MP-TOUTIAO
|
|
17
|
+
virtualHost: true,
|
|
18
|
+
// #endif
|
|
19
|
+
styleIsolation: 'shared'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
</script>
|
|
23
|
+
|
|
5
24
|
<script setup lang="ts">
|
|
6
25
|
import { ref, computed } from 'vue';
|
|
7
26
|
import { $u } from '../..';
|
|
8
27
|
import { TopTipsProps } from './types';
|
|
9
28
|
|
|
10
|
-
defineOptions({ name: 'u-top-tips' });
|
|
11
|
-
|
|
12
29
|
/**
|
|
13
30
|
* topTips 顶部提示
|
|
14
31
|
* @description 该组件一般用于页面顶部向下滑出一个提示,尔后自动收起的场景。
|
package/components/u-tr/types.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ExtractPropTypes } from 'vue';
|
|
2
|
+
import { baseProps } from '../common/props';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* TrProps tr props 类型定义
|
|
5
6
|
* @description 表格行组件,无特殊 props
|
|
6
7
|
*/
|
|
7
|
-
export const TrProps = {
|
|
8
|
+
export const TrProps = {
|
|
9
|
+
...baseProps
|
|
10
|
+
};
|
|
8
11
|
export type TrProps = ExtractPropTypes<typeof TrProps>;
|
package/components/u-tr/u-tr.vue
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-tr">
|
|
2
|
+
<view class="u-tr" :class="customClass" :style="$u.toStyle(customStyle)">
|
|
3
3
|
<slot></slot>
|
|
4
4
|
</view>
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
export default {
|
|
9
|
+
name: 'u-tr',
|
|
10
|
+
options: {
|
|
11
|
+
addGlobalClass: true,
|
|
12
|
+
// #ifndef MP-TOUTIAO
|
|
13
|
+
virtualHost: true,
|
|
14
|
+
// #endif
|
|
15
|
+
styleIsolation: 'shared'
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
</script>
|
|
19
|
+
|
|
7
20
|
<script setup lang="ts">
|
|
8
|
-
|
|
21
|
+
import { TrProps } from './types';
|
|
22
|
+
import { $u } from '../../';
|
|
9
23
|
|
|
10
24
|
/**
|
|
11
25
|
* tr 表格行标签
|
|
@@ -13,6 +27,7 @@ defineOptions({ name: 'u-tr' });
|
|
|
13
27
|
* @tutorial https://uviewpro.cn/zh/components/table.html
|
|
14
28
|
* @example <u-tr></u-tr>
|
|
15
29
|
*/
|
|
30
|
+
const props = defineProps(TrProps);
|
|
16
31
|
</script>
|
|
17
32
|
|
|
18
33
|
<style lang="scss" scoped>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ExtractPropTypes, PropType } from 'vue';
|
|
2
2
|
import type { ImgMode, UploadSizeType, UploadSourceType } from '../../types/global';
|
|
3
|
+
import { baseProps } from '../common/props';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* UploadProps upload props 类型定义
|
|
6
7
|
* @description 文件上传组件,支持多种自定义参数
|
|
7
8
|
*/
|
|
8
9
|
export const UploadProps = {
|
|
10
|
+
...baseProps,
|
|
9
11
|
/** 选择器宽度,单位rpx */
|
|
10
12
|
width: { type: [Number, String] as PropType<number | string>, default: 200 },
|
|
11
13
|
/** 选择器高度,单位rpx */
|
|
@@ -64,9 +66,15 @@ export const UploadProps = {
|
|
|
64
66
|
/** 是否显示提示 */
|
|
65
67
|
showTips: { type: Boolean, default: true },
|
|
66
68
|
/** 上传前钩子,返回true或Promise */
|
|
67
|
-
beforeUpload: {
|
|
69
|
+
beforeUpload: {
|
|
70
|
+
type: Function as PropType<((index: number, files: any[]) => boolean | Promise<any>) | null>,
|
|
71
|
+
default: null
|
|
72
|
+
},
|
|
68
73
|
/** 删除前钩子,返回true或Promise */
|
|
69
|
-
beforeRemove: {
|
|
74
|
+
beforeRemove: {
|
|
75
|
+
type: Function as PropType<((index: number, files: any[]) => boolean | Promise<any>) | null>,
|
|
76
|
+
default: null
|
|
77
|
+
},
|
|
70
78
|
/** 如果上传后的返回值为json字符串,是否转为json格式 */
|
|
71
79
|
toJson: { type: Boolean, default: true }
|
|
72
80
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="u-upload" v-if="!disabled">
|
|
2
|
+
<view class="u-upload" v-if="!disabled" :class="customClass" :style="$u.toStyle(customStyle)">
|
|
3
3
|
<view
|
|
4
4
|
v-if="showUploadList"
|
|
5
5
|
class="u-list-item u-preview-wrap"
|
|
@@ -28,7 +28,13 @@
|
|
|
28
28
|
:percent="item.progress"
|
|
29
29
|
></u-line-progress>
|
|
30
30
|
<view @tap.stop="retry(index)" v-if="item.error" class="u-error-btn">点击重试</view>
|
|
31
|
-
<image
|
|
31
|
+
<image
|
|
32
|
+
@tap.stop="doPreviewImage(item.url || item.path, index)"
|
|
33
|
+
class="u-preview-image"
|
|
34
|
+
v-if="!item.isImage"
|
|
35
|
+
:src="item.url || item.path"
|
|
36
|
+
:mode="imageMode"
|
|
37
|
+
></image>
|
|
32
38
|
</view>
|
|
33
39
|
<slot name="file" :file="lists"></slot>
|
|
34
40
|
<view style="display: inline-block" @tap="selectFile" v-if="Number(maxCount) > lists.length">
|
|
@@ -50,15 +56,24 @@
|
|
|
50
56
|
</view>
|
|
51
57
|
</template>
|
|
52
58
|
|
|
59
|
+
<script lang="ts">
|
|
60
|
+
export default {
|
|
61
|
+
name: 'u-upload',
|
|
62
|
+
options: {
|
|
63
|
+
addGlobalClass: true,
|
|
64
|
+
// #ifndef MP-TOUTIAO
|
|
65
|
+
virtualHost: true,
|
|
66
|
+
// #endif
|
|
67
|
+
styleIsolation: 'shared'
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
|
|
53
72
|
<script setup lang="ts">
|
|
54
73
|
import { ref, watch } from 'vue';
|
|
55
74
|
import { $u } from '../..';
|
|
56
75
|
import { UploadProps } from './types';
|
|
57
76
|
|
|
58
|
-
defineOptions({
|
|
59
|
-
name: 'u-upload'
|
|
60
|
-
});
|
|
61
|
-
|
|
62
77
|
/**
|
|
63
78
|
* upload 图片上传
|
|
64
79
|
* @description 该组件用于上传图片场景
|
|
@@ -259,7 +274,11 @@ async function uploadFile(index = 0) {
|
|
|
259
274
|
// 明白意思即可,无需纠结this.$u.$parent.call(this)的细节
|
|
260
275
|
let beforeResponse = props.beforeUpload(index, lists.value);
|
|
261
276
|
// 判断是否返回了promise
|
|
262
|
-
if (
|
|
277
|
+
if (
|
|
278
|
+
typeof beforeResponse === 'object' &&
|
|
279
|
+
beforeResponse !== null &&
|
|
280
|
+
typeof (beforeResponse as Promise<any>).then === 'function'
|
|
281
|
+
) {
|
|
263
282
|
await (beforeResponse as Promise<any>)
|
|
264
283
|
.then(() => {
|
|
265
284
|
// promise返回成功,不进行动作,继续上传
|
|
@@ -349,7 +368,11 @@ function deleteItem(index: number) {
|
|
|
349
368
|
// 此处钩子执行 原理同before-remove参数,见上方注释
|
|
350
369
|
let beforeResponse = props.beforeRemove(index, lists.value);
|
|
351
370
|
// 判断是否返回了promise
|
|
352
|
-
if (
|
|
371
|
+
if (
|
|
372
|
+
typeof beforeResponse === 'object' &&
|
|
373
|
+
beforeResponse !== null &&
|
|
374
|
+
typeof (beforeResponse as Promise<any>).then === 'function'
|
|
375
|
+
) {
|
|
353
376
|
await (beforeResponse as Promise<any>)
|
|
354
377
|
.then(() => {
|
|
355
378
|
// promise返回成功,不进行动作,继续上传
|