stellar-ui-v2 1.35.3
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/common/css/common.scss +61 -0
- package/components/ste-animate/README.md +117 -0
- package/components/ste-animate/animate.scss +247 -0
- package/components/ste-animate/ste-animate.vue +200 -0
- package/components/ste-badge/README.md +171 -0
- package/components/ste-badge/ste-badge.vue +238 -0
- package/components/ste-barcode/README.md +36 -0
- package/components/ste-barcode/encode2.js +317 -0
- package/components/ste-barcode/ste-barcode.vue +213 -0
- package/components/ste-button/README.md +129 -0
- package/components/ste-button/ste-button.vue +345 -0
- package/components/ste-calendar/README.md +304 -0
- package/components/ste-calendar/self-date.js +119 -0
- package/components/ste-calendar/ste-calendar.vue +578 -0
- package/components/ste-checkbox/README.md +297 -0
- package/components/ste-checkbox/ste-checkbox.vue +305 -0
- package/components/ste-checkbox-group/ste-checkbox-group.vue +133 -0
- package/components/ste-code-input/README.md +67 -0
- package/components/ste-code-input/ste-code-input.vue +302 -0
- package/components/ste-date-picker/README.md +135 -0
- package/components/ste-date-picker/ste-date-picker.vue +407 -0
- package/components/ste-drag/README.md +103 -0
- package/components/ste-drag/ste-drag.vue +203 -0
- package/components/ste-dropdown-menu/README.md +358 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +405 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +176 -0
- package/components/ste-icon/README.md +90 -0
- package/components/ste-icon/iconfont.css +8 -0
- package/components/ste-icon/ste-icon.vue +147 -0
- package/components/ste-image/README.md +154 -0
- package/components/ste-image/ste-image.vue +218 -0
- package/components/ste-index-item/ste-index-item.vue +96 -0
- package/components/ste-index-list/README.md +153 -0
- package/components/ste-index-list/ste-index-list.vue +128 -0
- package/components/ste-input/README.md +146 -0
- package/components/ste-input/ste-input.vue +480 -0
- package/components/ste-loading/README.md +81 -0
- package/components/ste-loading/ste-loading.vue +166 -0
- package/components/ste-media-preview/README.md +243 -0
- package/components/ste-media-preview/TouchScaleing.js +102 -0
- package/components/ste-media-preview/ste-media-preview.vue +267 -0
- package/components/ste-message-box/README.md +217 -0
- package/components/ste-message-box/ste-message-box.js +72 -0
- package/components/ste-message-box/ste-message-box.vue +380 -0
- package/components/ste-notice-bar/README.md +129 -0
- package/components/ste-notice-bar/ste-notice-bar.vue +331 -0
- package/components/ste-number-keyboard/README.md +246 -0
- package/components/ste-number-keyboard/keyboard.vue +140 -0
- package/components/ste-number-keyboard/ste-number-keyboard.vue +240 -0
- package/components/ste-picker/ste-picker.vue +258 -0
- package/components/ste-popup/README.md +148 -0
- package/components/ste-popup/ste-popup.vue +337 -0
- package/components/ste-price/README.md +129 -0
- package/components/ste-price/ste-price.vue +258 -0
- package/components/ste-progress/README.md +87 -0
- package/components/ste-progress/ste-progress.vue +200 -0
- package/components/ste-qrcode/README.md +50 -0
- package/components/ste-qrcode/ste-qrcode.vue +164 -0
- package/components/ste-qrcode/uqrcode.js +34 -0
- package/components/ste-radio/README.md +286 -0
- package/components/ste-radio/ste-radio.vue +293 -0
- package/components/ste-radio-group/ste-radio-group.vue +128 -0
- package/components/ste-rate/README.md +115 -0
- package/components/ste-rate/ste-rate.vue +202 -0
- package/components/ste-read-more/README.md +111 -0
- package/components/ste-read-more/ste-read-more.vue +133 -0
- package/components/ste-rich-text/README.md +31 -0
- package/components/ste-rich-text/ste-rich-text.vue +70 -0
- package/components/ste-scroll-to/README.md +68 -0
- package/components/ste-scroll-to/mixin.js +173 -0
- package/components/ste-scroll-to/ste-scroll-to.vue +45 -0
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +25 -0
- package/components/ste-search/README.md +262 -0
- package/components/ste-search/ste-search.vue +547 -0
- package/components/ste-select/README.md +434 -0
- package/components/ste-select/datapager.vue +62 -0
- package/components/ste-select/datetime.vue +106 -0
- package/components/ste-select/defaultDate.js +142 -0
- package/components/ste-select/ste-select.vue +843 -0
- package/components/ste-signature/README.md +105 -0
- package/components/ste-signature/ste-signature.vue +220 -0
- package/components/ste-slider/README.md +165 -0
- package/components/ste-slider/ste-slider.vue +544 -0
- package/components/ste-step/ste-step.vue +264 -0
- package/components/ste-stepper/README.md +170 -0
- package/components/ste-stepper/ste-stepper.vue +373 -0
- package/components/ste-steps/README.md +132 -0
- package/components/ste-steps/ste-steps.vue +65 -0
- package/components/ste-sticky/README.md +52 -0
- package/components/ste-sticky/ste-sticky.vue +127 -0
- package/components/ste-swipe-action/README.md +197 -0
- package/components/ste-swipe-action/ste-swipe-action.vue +303 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +104 -0
- package/components/ste-swiper/README.md +173 -0
- package/components/ste-swiper/ste-swiper.vue +462 -0
- package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
- package/components/ste-switch/README.md +110 -0
- package/components/ste-switch/ste-switch.vue +144 -0
- package/components/ste-tab/ste-tab.vue +87 -0
- package/components/ste-table/README.md +785 -0
- package/components/ste-table/common.js +8 -0
- package/components/ste-table/ste-table.vue +666 -0
- package/components/ste-table/utils.js +20 -0
- package/components/ste-table-column/checkbox-icon.vue +65 -0
- package/components/ste-table-column/common.scss +65 -0
- package/components/ste-table-column/radio-icon.vue +110 -0
- package/components/ste-table-column/ste-table-column.vue +255 -0
- package/components/ste-table-column/sub-table.vue +116 -0
- package/components/ste-table-column/table-popover.vue +204 -0
- package/components/ste-table-column/var.scss +1 -0
- package/components/ste-tabs/README.md +475 -0
- package/components/ste-tabs/props.js +212 -0
- package/components/ste-tabs/ste-tabs.vue +758 -0
- package/components/ste-text/README.md +66 -0
- package/components/ste-text/ste-text.vue +72 -0
- package/components/ste-toast/README.md +243 -0
- package/components/ste-toast/ste-toast.js +69 -0
- package/components/ste-toast/ste-toast.vue +231 -0
- package/components/ste-touch-swipe/README.md +104 -0
- package/components/ste-touch-swipe/TouchEvent.js +72 -0
- package/components/ste-touch-swipe/ste-touch-swipe.vue +327 -0
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +33 -0
- package/components/ste-tour/README.md +194 -0
- package/components/ste-tour/ste-tour.vue +355 -0
- package/components/ste-tree/README.md +240 -0
- package/components/ste-tree/ste-tree.vue +350 -0
- package/components/ste-upload/README.md +276 -0
- package/components/ste-upload/ReadFile.js +229 -0
- package/components/ste-upload/ste-upload.vue +526 -0
- package/components/ste-video/README.md +60 -0
- package/components/ste-video/props.js +149 -0
- package/components/ste-video/ste-video.vue +647 -0
- package/config/color.js +22 -0
- package/index.js +2 -0
- package/package.json +19 -0
- package/utils/Color.js +66 -0
- package/utils/System.js +110 -0
- package/utils/dayjs.min.js +1 -0
- package/utils/mixin.js +67 -0
- package/utils/store.js +7 -0
- package/utils/utils.js +604 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-icon-root" :style="[cmpCssVar]" @click="handleClick">
|
|
3
|
+
{{ cmpCode }}
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import utils from '../../utils/utils.js';
|
|
9
|
+
/**
|
|
10
|
+
* ste-icon 图标
|
|
11
|
+
* @description 图标组件 基于字体的图标集,包含了大多数常见场景的图标
|
|
12
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-icon
|
|
13
|
+
* @property {String} code 图标名称
|
|
14
|
+
* @property {String} color 图标颜色
|
|
15
|
+
* @property {Number|String} size 图标大小,单位rpx,默认28
|
|
16
|
+
* @property {Boolean} bold 图标是否粗体,默认false
|
|
17
|
+
* @property {Number|String} marginLeft 左外边距,单位rpx,默认0
|
|
18
|
+
* @property {Number|String} marginRight 右外边距,单位rpx,默认0
|
|
19
|
+
* @property {Number|String} marginTop 上外边距,单位rpx,默认0
|
|
20
|
+
* @property {Number|String} marginBottom 下外边距,单位rpx,默认0
|
|
21
|
+
* @property {String} fontFamily 字体名 默认''
|
|
22
|
+
* @property {Boolean} inlineBlock 容器对齐方式 默认true
|
|
23
|
+
* @event {Function} click 图标点击回调事件
|
|
24
|
+
*/
|
|
25
|
+
export default {
|
|
26
|
+
group: '基础组件',
|
|
27
|
+
title: 'Icon 图标',
|
|
28
|
+
name: 'ste-icon',
|
|
29
|
+
options: {
|
|
30
|
+
virtualHost: true,
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
// iconfont unicode
|
|
34
|
+
code: {
|
|
35
|
+
type: [String, null],
|
|
36
|
+
required: true,
|
|
37
|
+
},
|
|
38
|
+
// 字体大小
|
|
39
|
+
size: {
|
|
40
|
+
type: [Number, String, null],
|
|
41
|
+
default: 28,
|
|
42
|
+
},
|
|
43
|
+
scale: {
|
|
44
|
+
type: [Number, null],
|
|
45
|
+
default: 1,
|
|
46
|
+
},
|
|
47
|
+
// 颜色
|
|
48
|
+
color: {
|
|
49
|
+
type: [String, null],
|
|
50
|
+
default: '',
|
|
51
|
+
},
|
|
52
|
+
// 图标是否粗体
|
|
53
|
+
bold: {
|
|
54
|
+
type: [Boolean, null],
|
|
55
|
+
default: false,
|
|
56
|
+
},
|
|
57
|
+
// 左外边距
|
|
58
|
+
marginLeft: {
|
|
59
|
+
type: [Number, String, null],
|
|
60
|
+
default: 0,
|
|
61
|
+
},
|
|
62
|
+
// 右外边距
|
|
63
|
+
marginRight: {
|
|
64
|
+
type: [Number, String, null],
|
|
65
|
+
default: 0,
|
|
66
|
+
},
|
|
67
|
+
// 上外边距
|
|
68
|
+
marginTop: {
|
|
69
|
+
type: [Number, String, null],
|
|
70
|
+
default: 0,
|
|
71
|
+
},
|
|
72
|
+
// 下外边距
|
|
73
|
+
marginBottom: {
|
|
74
|
+
type: [Number, String, null],
|
|
75
|
+
default: 0,
|
|
76
|
+
},
|
|
77
|
+
fontFamily: {
|
|
78
|
+
type: [String, null],
|
|
79
|
+
default: '',
|
|
80
|
+
},
|
|
81
|
+
showBorder: {
|
|
82
|
+
type: [Boolean, null],
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
// 容器对齐方式 true inline-block false inline-flex
|
|
86
|
+
inlineBlock: {
|
|
87
|
+
type: [Boolean, null],
|
|
88
|
+
default: true,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
data() {
|
|
92
|
+
return {
|
|
93
|
+
defaultFontFamily: 'ste-iconfont-1709689042473', // 和iconfont项目中的字体名保持一致
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
mounted() {},
|
|
97
|
+
computed: {
|
|
98
|
+
cmpCode() {
|
|
99
|
+
// unicode编码转字符
|
|
100
|
+
return String.fromCharCode(this.code.replace('&#', '0').replace(';', ''));
|
|
101
|
+
},
|
|
102
|
+
cmpCssVar() {
|
|
103
|
+
return {
|
|
104
|
+
'--border': this.showBorder ? '1px' : '0px',
|
|
105
|
+
'--color': this.color,
|
|
106
|
+
'--size': utils.formatPx(this.size),
|
|
107
|
+
'--weight': this.bold ? 'bold' : 'normal',
|
|
108
|
+
'--margin-left': utils.formatPx(this.marginLeft),
|
|
109
|
+
'--margin-right': utils.formatPx(this.marginRight),
|
|
110
|
+
'--margin-top': utils.formatPx(this.marginTop),
|
|
111
|
+
'--margin-bottom': utils.formatPx(this.marginBottom),
|
|
112
|
+
'--font-family': this.fontFamily === '' ? this.defaultFontFamily : this.fontFamily,
|
|
113
|
+
'--display': this.inlineBlock ? 'inline-block' : 'inline-flex',
|
|
114
|
+
};
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
methods: {
|
|
118
|
+
handleClick() {
|
|
119
|
+
this.$emit('click');
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style lang="scss" scoped>
|
|
126
|
+
@import './iconfont.css';
|
|
127
|
+
.ste-icon-root {
|
|
128
|
+
display: var(--display);
|
|
129
|
+
justify-content: center;
|
|
130
|
+
align-items: center;
|
|
131
|
+
vertical-align: baseline;
|
|
132
|
+
border-width: var(--border);
|
|
133
|
+
border-color: #bbb;
|
|
134
|
+
border-style: solid;
|
|
135
|
+
|
|
136
|
+
margin-left: var(--margin-left) !important;
|
|
137
|
+
margin-right: var(--margin-right) !important;
|
|
138
|
+
transform: translateY(calc(var(--margin-bottom) - var(--margin-top))) !important ;
|
|
139
|
+
|
|
140
|
+
width: calc(var(--size)) !important;
|
|
141
|
+
line-height: calc(var(--size) - var(--border) * 2) !important;
|
|
142
|
+
font-family: var(--font-family) !important;
|
|
143
|
+
font-size: calc(var(--size) - var(--border) * 2) !important;
|
|
144
|
+
color: var(--color);
|
|
145
|
+
font-weight: var(--weight) !important;
|
|
146
|
+
}
|
|
147
|
+
</style>
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Image 图片
|
|
2
|
+
图片组件,对原生`image`组件进行了扩展。
|
|
3
|
+
|
|
4
|
+
---$
|
|
5
|
+
|
|
6
|
+
### 代码演示
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#### 不同填充模式的图片
|
|
10
|
+
- 通过`src`属性设置图片地址
|
|
11
|
+
- 通过`width`属性设置图片宽度
|
|
12
|
+
- 通过`height`属性设置图片高度
|
|
13
|
+
- 通过`mode`属性设置图片的裁剪和拉伸
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" width="200" height="200" />
|
|
17
|
+
<ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" width="200" height="200" mode="aspectFit"/>
|
|
18
|
+
<ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" width="200" height="200" mode="aspectFill"/>
|
|
19
|
+
<ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" width="200" mode="widthFix"/>
|
|
20
|
+
<ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" height="200" mode="heightFix"/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
#### 圆角
|
|
24
|
+
- 通过`radius`属性设置图片圆角属性
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" radius="50%" width="200" height="200" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
#### 加载效果
|
|
31
|
+
- 通过`hiddenLoading`关闭图片加载中提示
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<template>
|
|
35
|
+
<view>
|
|
36
|
+
<view class="image-box">
|
|
37
|
+
<ste-image :src="imgUrl" width="200" height="200" />
|
|
38
|
+
<view class="msg">加载中提示</view>
|
|
39
|
+
</view>
|
|
40
|
+
<view class="image-box">
|
|
41
|
+
<ste-image :src="imgUrl" hiddenLoading width="200" height="200" />
|
|
42
|
+
<view class="msg">隐藏加载中提示</view>
|
|
43
|
+
</view>
|
|
44
|
+
</view>
|
|
45
|
+
</template>
|
|
46
|
+
<script>
|
|
47
|
+
export default {
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
imgUrl: '',
|
|
51
|
+
};
|
|
52
|
+
},
|
|
53
|
+
watch: {},
|
|
54
|
+
mounted() {
|
|
55
|
+
setTimeout(() => {
|
|
56
|
+
this.imgUrl = 'https://image.whzb.com/chain/StellarUI/图片.jpg';
|
|
57
|
+
}, 1500);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
#### 加载失败
|
|
63
|
+
- 通过`hiddenError`隐藏图片加载失败提示
|
|
64
|
+
|
|
65
|
+
```html
|
|
66
|
+
<template>
|
|
67
|
+
<view>
|
|
68
|
+
<view class="image-box">
|
|
69
|
+
<ste-image :src="errorUrl" width="200" height="200" />
|
|
70
|
+
<view class="msg">加载失败提示</view>
|
|
71
|
+
</view>
|
|
72
|
+
<view class="image-box">
|
|
73
|
+
<ste-image :src="errorUrl" hiddenError width="200" height="200" />
|
|
74
|
+
<view class="msg">关闭加载失败提示</view>
|
|
75
|
+
</view>
|
|
76
|
+
</view>
|
|
77
|
+
</template>
|
|
78
|
+
<script>
|
|
79
|
+
export default {
|
|
80
|
+
data() {
|
|
81
|
+
return {
|
|
82
|
+
errorUrl: '',
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
watch: {},
|
|
86
|
+
mounted() {
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
this.errorUrl = 'https://image.whzb.com/chain/StellarUI/none.png';
|
|
89
|
+
}, 1500);
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
</script>
|
|
93
|
+
```
|
|
94
|
+
#### 具名插槽
|
|
95
|
+
- 通过`loading`具名插槽可以自定义加载中内容
|
|
96
|
+
- 通过`error`具名插槽可以自定义加载失败内容
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<ste-image :src="errorUrl" width="200" height="200">
|
|
100
|
+
<template v-slot:loading>Loading...</template>
|
|
101
|
+
<template v-slot:error>Error</template>
|
|
102
|
+
</ste-image>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
---$
|
|
107
|
+
### API
|
|
108
|
+
#### Props
|
|
109
|
+
|属性名 |说明 | 类型 | 默认值 | 可选值 |支持版本 |
|
|
110
|
+
| --- |--- |--- |--- |--- |--- |
|
|
111
|
+
| `src` | 图片源,同原生 | `String` | - | - |- |
|
|
112
|
+
| `mode` | 图片裁剪、缩放的模式 | `String` | `"scaleToFill"` | 见下面`Mode`表格 |- |
|
|
113
|
+
| `width` | 宽度:`Number`单位`rpx`,`String`同原生 | `Number/String` | `"100%"` | - |- |
|
|
114
|
+
| `height` | 高度:`Number`单位`rpx`,`String`同原生 | `Number/String` | `"100%"` | - |- |
|
|
115
|
+
| `radius` | 圆角:`Number`单位`rpx`,`String`同原生 | `Number/String` | `0` | - |- |
|
|
116
|
+
| `hiddenLoading` | 是否隐藏图片未加载的占位内容 | `Boolean` | `false` | - |- |
|
|
117
|
+
| `hiddenError` | 是否隐藏图片加载失败的占位内容 | `Boolean` | `false` | - |- |
|
|
118
|
+
| `showMenuByLongpress` | 长按图片显示发送给朋友、收藏、保存图片、搜一搜、打开名片/前往群聊/打开小程序(若图片中包含对应二维码或小程序码)的菜单 | `Boolean` | `false` | - |微信小程序`2.13.0` |
|
|
119
|
+
| `lazyLoad` | 图片懒加载,在即将进入一定范围(上下三屏)时才开始加载 | `Boolean` | `false` | - |- |
|
|
120
|
+
| `display` | 盒子模型 | `String` | `inline-flex` | 可选属性同css同名属性值 |- |
|
|
121
|
+
|
|
122
|
+
##### Mode
|
|
123
|
+
|合法值 |说明 |
|
|
124
|
+
| --- |--- |
|
|
125
|
+
| `scaleToFill` | 缩放模式,不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素 |
|
|
126
|
+
| `aspectFit` | 缩放模式,保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来 |
|
|
127
|
+
| `aspectFill` | 缩放模式,保持纵横比缩放图片,只保证图片的短边能完全显示出来。也就是说,图片通常只在水平或垂直方向是完整的,另一个方向将会发生截取 |
|
|
128
|
+
| `widthFix` | 缩放模式,宽度不变,高度自动变化,保持原图宽高比不变 |
|
|
129
|
+
| `heightFix` | 缩放模式,高度不变,宽度自动变化,保持原图宽高比不变 |
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
#### Events
|
|
133
|
+
- 您可以通过监听`load`事件,监听图片是否加载完成
|
|
134
|
+
- 您可以通过监听`error`事件,监听图片是否加载失败
|
|
135
|
+
|
|
136
|
+
|事件名 |说明 |事件参数 |支持版本 |
|
|
137
|
+
|--- |--- |--- |--- |
|
|
138
|
+
| `click` | 图片点击触发 |`event` | - |
|
|
139
|
+
| `load` | 图片加载成功触发 |`event` | - |
|
|
140
|
+
| `error` | 图片加载失败触发 |`event` | - |
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
#### Slots
|
|
144
|
+
|插槽名 | 说明 | 插槽参数 | 支持版本 |
|
|
145
|
+
| --- | --- | --- | --- |
|
|
146
|
+
| `loading` | 加载中内容插槽 |- | - |
|
|
147
|
+
| `error` | 加载失败内容插槽 |- | - |
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
---$
|
|
151
|
+
{{xuyajun}}
|
|
152
|
+
|
|
153
|
+
{{qinpengfei}}
|
|
154
|
+
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-image-root" :style="[cmpStyle]">
|
|
3
|
+
<view class="loading-icon" v-if="!hiddenLoading && status === 0">
|
|
4
|
+
<slot name="loading">
|
|
5
|
+
<ste-icon code="" :size="iconSize" />
|
|
6
|
+
</slot>
|
|
7
|
+
</view>
|
|
8
|
+
|
|
9
|
+
<image
|
|
10
|
+
class="content"
|
|
11
|
+
:style="{ opacity: status === 1 ? '1' : '0' }"
|
|
12
|
+
:src="src"
|
|
13
|
+
:mode="mode"
|
|
14
|
+
:lazy-load="lazyLoad"
|
|
15
|
+
:show-menu-by-longpress="showMenuByLongpress"
|
|
16
|
+
@load="onLoadOver"
|
|
17
|
+
@error="onFault"
|
|
18
|
+
@click="click"
|
|
19
|
+
></image>
|
|
20
|
+
|
|
21
|
+
<view class="loading-icon" v-if="!hiddenError && status === 2">
|
|
22
|
+
<slot name="error">
|
|
23
|
+
<ste-icon code="" :size="iconSize" />
|
|
24
|
+
</slot>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script>
|
|
30
|
+
import utils from '../../utils/utils.js';
|
|
31
|
+
/**
|
|
32
|
+
* ste-image 图片
|
|
33
|
+
* @description 图片组件
|
|
34
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-image
|
|
35
|
+
* @property {String} src 图片地址
|
|
36
|
+
* @property {String} mode 图片裁剪、缩放的模式 默认值:scaleToFill
|
|
37
|
+
* @value scaleToFill 缩放(默认):不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素 {String}
|
|
38
|
+
* @value aspectFit 缩放:保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来 {String}
|
|
39
|
+
* @value aspectFill 缩放:保持纵横比缩放图片,只保证图片的短边能完全显示出来。也就是说,图片通常只在水平或垂直方向是完整的,另一个方向将会发生截取 {String}
|
|
40
|
+
* @value widthFix 缩放:宽度不变,高度自动变化,保持原图宽高比不变 {String}
|
|
41
|
+
* @value heightFix 缩放:高度不变,宽度自动变化,保持原图宽高比不变 App 和 H5 平台 HBuilderX 2.9.3+ 支持、微信小程序需要基础库 2.10.3 {String}
|
|
42
|
+
* @property {String|Number} width 宽度:(默认值100%)Number-单位rpx,String-同原生
|
|
43
|
+
* @property {String|Number} height 高度:(默认值100%)Number-单位rpx,String-同原生
|
|
44
|
+
* @property {String|Number} radius 圆角:(默认值0)Number-单位rpx,String-同原生
|
|
45
|
+
* @property {Boolean} hiddenLoading 是否隐藏图片加载中内容
|
|
46
|
+
* @property {Boolean} hiddenError 是否隐藏加载失败的内容
|
|
47
|
+
* @property {Boolean} showMenuByLongpress 长按图片显示发送给朋友、收藏、保存图片、搜一搜、打开名片/前往群聊/打开小程序(若图片中包含对应二维码或小程序码)的菜单。
|
|
48
|
+
* @property {Boolean} lazyLoad 图片懒加载,在即将进入一定范围(上下三屏)时才开始加载
|
|
49
|
+
* @property {String} display 盒子模型
|
|
50
|
+
* @value inline-flex 行内弹性盒子(默认)
|
|
51
|
+
* @value flex 块级弹性盒子
|
|
52
|
+
* @value block 块级盒子
|
|
53
|
+
* @value inline-block 行内块级盒子
|
|
54
|
+
* @value none 隐藏
|
|
55
|
+
* @value inherit 继承父元素
|
|
56
|
+
* @value inline 行内元素
|
|
57
|
+
* @event {Function} click 点击事件
|
|
58
|
+
* @event {Function} load 加载成功事件
|
|
59
|
+
* @event {Function} error 加载失败事件
|
|
60
|
+
*/
|
|
61
|
+
export default {
|
|
62
|
+
group: '基础组件',
|
|
63
|
+
title: 'Image 图片',
|
|
64
|
+
name: 'ste-image',
|
|
65
|
+
props: {
|
|
66
|
+
src: {
|
|
67
|
+
type: [String, null],
|
|
68
|
+
default: () => '',
|
|
69
|
+
},
|
|
70
|
+
mode: {
|
|
71
|
+
type: [String, null],
|
|
72
|
+
default: () => 'scaleToFill',
|
|
73
|
+
},
|
|
74
|
+
width: {
|
|
75
|
+
type: [Number, String, null],
|
|
76
|
+
default: () => '100%',
|
|
77
|
+
},
|
|
78
|
+
height: {
|
|
79
|
+
type: [Number, String, null],
|
|
80
|
+
default: () => '100%',
|
|
81
|
+
},
|
|
82
|
+
radius: {
|
|
83
|
+
type: [Number, String, null],
|
|
84
|
+
default: () => 0,
|
|
85
|
+
},
|
|
86
|
+
hiddenLoading: {
|
|
87
|
+
type: [Boolean, null],
|
|
88
|
+
default: () => false,
|
|
89
|
+
},
|
|
90
|
+
hiddenError: {
|
|
91
|
+
type: [Boolean, null],
|
|
92
|
+
default: () => false,
|
|
93
|
+
},
|
|
94
|
+
showMenuByLongpress: {
|
|
95
|
+
type: [Boolean, null],
|
|
96
|
+
default: () => false,
|
|
97
|
+
},
|
|
98
|
+
lazyLoad: {
|
|
99
|
+
type: [Boolean, null],
|
|
100
|
+
default: () => false,
|
|
101
|
+
},
|
|
102
|
+
display: {
|
|
103
|
+
type: [String, null],
|
|
104
|
+
default: () => 'inline-flex',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
status: 1,
|
|
110
|
+
initializing: true,
|
|
111
|
+
iconSize: 60,
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
computed: {
|
|
115
|
+
cmpStyle() {
|
|
116
|
+
let width = isNaN(this.width) ? this.width : utils.formatPx(this.width);
|
|
117
|
+
let height = isNaN(this.height) ? this.height : utils.formatPx(this.height);
|
|
118
|
+
if (this.mode === 'widthFix') {
|
|
119
|
+
if (this.status !== 1) {
|
|
120
|
+
height = width;
|
|
121
|
+
} else {
|
|
122
|
+
height = 'auto';
|
|
123
|
+
}
|
|
124
|
+
} else if (this.mode === 'heightFix') {
|
|
125
|
+
if (this.status !== 1) {
|
|
126
|
+
width = height;
|
|
127
|
+
} else {
|
|
128
|
+
width = 'auto';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
'--image-root-width': width,
|
|
133
|
+
'--image-root-height': height,
|
|
134
|
+
'--image-root-display': this.display,
|
|
135
|
+
'--image-root-radius': utils.formatPx(this.radius),
|
|
136
|
+
'--image-root-background-color': this.status === 1 ? 'none' : 'rgba(127,127,127,.05)',
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
watch: {
|
|
141
|
+
src() {
|
|
142
|
+
this.status = 0;
|
|
143
|
+
},
|
|
144
|
+
hiddenLoading: {
|
|
145
|
+
handler(v) {
|
|
146
|
+
if (v && this.hiddenError) this.status = 1;
|
|
147
|
+
},
|
|
148
|
+
immediate: true,
|
|
149
|
+
},
|
|
150
|
+
hiddenError: {
|
|
151
|
+
handler(v) {
|
|
152
|
+
if (v && this.hiddenLoading) this.status = 1;
|
|
153
|
+
},
|
|
154
|
+
immediate: true,
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
mounted() {
|
|
158
|
+
this.setIconSize();
|
|
159
|
+
setTimeout(() => {
|
|
160
|
+
if (this.initializing) this.status = 0;
|
|
161
|
+
}, 25);
|
|
162
|
+
},
|
|
163
|
+
methods: {
|
|
164
|
+
click(e) {
|
|
165
|
+
this.$emit('click', e);
|
|
166
|
+
},
|
|
167
|
+
onLoadOver(e) {
|
|
168
|
+
this.initializing = false;
|
|
169
|
+
if (this.status !== 1) this.status = 1;
|
|
170
|
+
this.$emit('load', e);
|
|
171
|
+
},
|
|
172
|
+
onFault(e) {
|
|
173
|
+
this.initializing = false;
|
|
174
|
+
if (this.status !== 2) this.status = 2;
|
|
175
|
+
this.$emit('error', e);
|
|
176
|
+
},
|
|
177
|
+
setIconSize() {
|
|
178
|
+
this.$nextTick(async () => {
|
|
179
|
+
const dom = await utils.querySelector('.ste-image-root', this);
|
|
180
|
+
// 因为查找dom为异步方法 组件销毁后,该方法继续执行导致报错
|
|
181
|
+
if (!dom) return;
|
|
182
|
+
const size = dom.width <= dom.height ? dom.width : dom.height;
|
|
183
|
+
if (size <= 30) this.iconSize = 12 * 2;
|
|
184
|
+
else if (size <= 50) this.iconSize = 20 * 2;
|
|
185
|
+
else if (size <= 100) this.iconSize = 30 * 2;
|
|
186
|
+
else if (size <= 150) this.iconSize = 50 * 2;
|
|
187
|
+
else this.iconSize = 70 * 2;
|
|
188
|
+
});
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
</script>
|
|
193
|
+
|
|
194
|
+
<style lang="scss" scoped>
|
|
195
|
+
.ste-image-root {
|
|
196
|
+
width: var(--image-root-width);
|
|
197
|
+
height: var(--image-root-height);
|
|
198
|
+
display: var(--image-root-display);
|
|
199
|
+
font-size: 24rpx;
|
|
200
|
+
color: #bbbbbb;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
align-items: center;
|
|
203
|
+
background-color: var(--image-root-background-color);
|
|
204
|
+
border-radius: var(--image-root-radius);
|
|
205
|
+
overflow: hidden;
|
|
206
|
+
line-height: 1;
|
|
207
|
+
vertical-align: top;
|
|
208
|
+
position: relative;
|
|
209
|
+
& > .content {
|
|
210
|
+
width: var(--image-root-width);
|
|
211
|
+
height: var(--image-root-height);
|
|
212
|
+
}
|
|
213
|
+
.loading-icon {
|
|
214
|
+
position: absolute;
|
|
215
|
+
z-index: 2;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
</style>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ste-scroll-to-item-root">
|
|
3
|
+
<slot name="title">
|
|
4
|
+
<block v-if="title">
|
|
5
|
+
<ste-sticky v-if="sticky">
|
|
6
|
+
<view class="index-item-title" :class="{ active }">{{ title }}</view>
|
|
7
|
+
</ste-sticky>
|
|
8
|
+
<view v-else class="index-item-title" :class="{ active }">{{ title }}</view>
|
|
9
|
+
</block>
|
|
10
|
+
</slot>
|
|
11
|
+
<slot>
|
|
12
|
+
<view class="index-item-text-list">
|
|
13
|
+
<view class="index-item-text" v-for="(text, i) in list" :key="i" @click="onClickItem(text)">
|
|
14
|
+
{{ text }}
|
|
15
|
+
</view>
|
|
16
|
+
</view>
|
|
17
|
+
</slot>
|
|
18
|
+
</view>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import utils from '../../utils/utils.js';
|
|
23
|
+
import { childMixin } from '../../utils/mixin.js';
|
|
24
|
+
/**
|
|
25
|
+
* ste-index-item 锚点项
|
|
26
|
+
* @description 锚点项
|
|
27
|
+
* @tutorial https://stellar-ui.intecloud.com.cn/pc/index/index?name=ste-scroll-to
|
|
28
|
+
* @property {String} title 分组标题
|
|
29
|
+
* @property {Array<String>} list 分组字符串列表
|
|
30
|
+
*/
|
|
31
|
+
export default {
|
|
32
|
+
name: 'ste-index-item',
|
|
33
|
+
mixins: [childMixin('ste-index-list')],
|
|
34
|
+
props: {
|
|
35
|
+
title: {
|
|
36
|
+
type: [String, null],
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
list: {
|
|
40
|
+
type: [Array, null],
|
|
41
|
+
default: () => [],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
data() {
|
|
45
|
+
return {
|
|
46
|
+
sticky: true,
|
|
47
|
+
active: false,
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
mounted() {
|
|
51
|
+
this.$nextTick(() => {
|
|
52
|
+
this.sticky = this.parent.sticky;
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
setActive(bool) {
|
|
57
|
+
this.active = bool;
|
|
58
|
+
},
|
|
59
|
+
onClickItem(item) {
|
|
60
|
+
this.parent.onClickItem(this.title, item);
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<style lang="scss" scoped>
|
|
67
|
+
.ste-scroll-to-item-root {
|
|
68
|
+
width: 100%;
|
|
69
|
+
.index-item-title {
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 80rpx;
|
|
72
|
+
line-height: 80rpx;
|
|
73
|
+
font-size: 32rpx;
|
|
74
|
+
padding: 0 32rpx;
|
|
75
|
+
background-color: #f5f5f5;
|
|
76
|
+
color: var(--ste-index-list-inactive-color);
|
|
77
|
+
&.active {
|
|
78
|
+
color: var(--ste-index-list-active-color);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
.index-item-text-list {
|
|
82
|
+
padding: 0 32rpx;
|
|
83
|
+
background-color: #fff;
|
|
84
|
+
.index-item-text {
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 92rpx;
|
|
87
|
+
line-height: 92rpx;
|
|
88
|
+
font-family: PingFang SC, PingFang SC;
|
|
89
|
+
font-weight: 400;
|
|
90
|
+
font-size: 32rpx;
|
|
91
|
+
color: #252525;
|
|
92
|
+
border-bottom: 2rpx solid #f9f9f9;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
</style>
|