stellar-ui-v2 1.40.20 → 1.40.21
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/README.md +8 -8
- package/components/ste-index-list/README.md +6 -6
- package/components/ste-message-box/ste-message-box.js +72 -72
- package/components/ste-message-box/ste-message-box.vue +364 -364
- package/components/ste-pate-container/README.md +149 -0
- package/components/ste-pate-container/config.json +5 -0
- package/components/ste-pate-container/ste-pate-container.vue +220 -0
- package/components/ste-popup/README.md +16 -16
- package/components/ste-popup/ste-popup.vue +392 -392
- package/components/ste-price/ste-price.vue +256 -256
- package/components/ste-rate/README.md +13 -13
- package/components/ste-search/ste-search.vue +590 -590
- package/components/ste-select/datetime.vue +106 -106
- package/components/ste-table-column/checkbox-icon.vue +65 -65
- package/components/ste-table-column/radio-icon.vue +110 -110
- package/components/ste-table-column/sub-table.vue +116 -116
- package/components/ste-tabs/props.js +212 -212
- package/components/ste-toast/ste-toast.js +69 -69
- package/components/ste-video/ste-video.vue +756 -756
- package/package.json +18 -18
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# PageContainer 页面容器
|
|
2
|
+
|
|
3
|
+
---$
|
|
4
|
+
|
|
5
|
+
### 说明
|
|
6
|
+
`ste-pate-container` 在不同平台的实现方式:
|
|
7
|
+
|
|
8
|
+
- `MP-WEIXIN`:使用微信小程序原生 `page-container`
|
|
9
|
+
- 其他平台:基于 `ste-popup` 兼容实现
|
|
10
|
+
- 微信单页限制:原生 `page-container` 同一页面仅允许 1 个实例;当页面存在多个 `ste-pate-container` 时,首个实例使用原生能力,其余实例自动降级为 `ste-popup`
|
|
11
|
+
|
|
12
|
+
为保持 API 一致,组件对外暴露 `page-container` 常用属性和事件。
|
|
13
|
+
|
|
14
|
+
---$
|
|
15
|
+
|
|
16
|
+
### 代码演示
|
|
17
|
+
|
|
18
|
+
#### 基础用法
|
|
19
|
+
```vue
|
|
20
|
+
<template>
|
|
21
|
+
<ste-pate-container
|
|
22
|
+
:show.sync="show"
|
|
23
|
+
position="bottom"
|
|
24
|
+
:overlay="true"
|
|
25
|
+
:round="true"
|
|
26
|
+
custom-style="height: 60vh;"
|
|
27
|
+
>
|
|
28
|
+
<view class="content">内容区域</view>
|
|
29
|
+
</ste-pate-container>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
export default {
|
|
34
|
+
data() {
|
|
35
|
+
return {
|
|
36
|
+
show: false,
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### 方法调用
|
|
44
|
+
```vue
|
|
45
|
+
<template>
|
|
46
|
+
<ste-pate-container ref="pc" :show.sync="show">
|
|
47
|
+
<view>内容区域</view>
|
|
48
|
+
</ste-pate-container>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script>
|
|
52
|
+
export default {
|
|
53
|
+
data() {
|
|
54
|
+
return {
|
|
55
|
+
show: false,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
openBox() {
|
|
60
|
+
this.$refs.pc.open();
|
|
61
|
+
},
|
|
62
|
+
closeBox() {
|
|
63
|
+
this.$refs.pc.close();
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### 事件监听
|
|
71
|
+
```vue
|
|
72
|
+
<ste-pate-container
|
|
73
|
+
:show.sync="show"
|
|
74
|
+
@beforeenter="onEvent('beforeenter')"
|
|
75
|
+
@afterenter="onEvent('afterenter')"
|
|
76
|
+
@clickoverlay="onEvent('clickoverlay')"
|
|
77
|
+
>
|
|
78
|
+
<view>内容区域</view>
|
|
79
|
+
</ste-pate-container>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
#### 微信专属属性
|
|
83
|
+
```vue
|
|
84
|
+
<ste-pate-container
|
|
85
|
+
:show.sync="show"
|
|
86
|
+
:closeOnSlideDown="true"
|
|
87
|
+
overlayStyle="background: rgba(0, 144, 255, 0.45);"
|
|
88
|
+
customStyle="height: 50vh;"
|
|
89
|
+
>
|
|
90
|
+
<view>微信小程序下支持下滑关闭和自定义遮罩样式</view>
|
|
91
|
+
</ste-pate-container>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---$
|
|
95
|
+
|
|
96
|
+
### API
|
|
97
|
+
|
|
98
|
+
#### Props
|
|
99
|
+
|
|
100
|
+
| 属性名 | 说明 | 类型 | 默认值 | 平台支持 |
|
|
101
|
+
| --- | --- | --- | --- | --- |
|
|
102
|
+
| `show` | 是否显示容器 | `Boolean` | `false` | 全平台 |
|
|
103
|
+
| `duration` | 动画时长,单位 ms | `Number` | `300` | 全平台 |
|
|
104
|
+
| `zIndex` | 层级 | `Number/String` | `100` | 全平台 |
|
|
105
|
+
| `overlay` | 是否显示遮罩 | `Boolean` | `true` | 全平台 |
|
|
106
|
+
| `position` | 弹出位置:`top`/`bottom`/`right`/`center` | `String` | `bottom` | 全平台 |
|
|
107
|
+
| `round` | 是否展示圆角 | `Boolean` | `false` | 全平台 |
|
|
108
|
+
| `customStyle` | 容器样式 | `String` | `''` | 全平台 |
|
|
109
|
+
| `safeAreaInsetBottom` | 是否适配底部安全区 | `Boolean` | `false` | 全平台(非微信为兼容实现) |
|
|
110
|
+
| `closeOnSlideDown` | 是否允许下滑关闭 | `Boolean` | `false` | 仅微信小程序 |
|
|
111
|
+
| `overlayStyle` | 遮罩层样式 | `String` | `''` | 仅微信小程序 |
|
|
112
|
+
|
|
113
|
+
#### Events
|
|
114
|
+
|
|
115
|
+
| 事件名 | 说明 | 平台支持 |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| `beforeenter` | 进入前触发 | 全平台(非微信为兼容模拟) |
|
|
118
|
+
| `enter` | 进入中触发 | 全平台(非微信为兼容模拟) |
|
|
119
|
+
| `afterenter` | 进入结束触发 | 全平台 |
|
|
120
|
+
| `beforeleave` | 离开前触发 | 全平台(非微信为兼容模拟) |
|
|
121
|
+
| `leave` | 离开中触发 | 全平台(非微信为兼容模拟) |
|
|
122
|
+
| `afterleave` | 离开结束触发 | 全平台(非微信为兼容模拟) |
|
|
123
|
+
| `clickoverlay` | 点击遮罩触发 | 全平台 |
|
|
124
|
+
| `update:show` | 显隐双向绑定事件 | 全平台 |
|
|
125
|
+
|
|
126
|
+
#### Methods
|
|
127
|
+
|
|
128
|
+
| 方法名 | 说明 | 参数 |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| `open` | 打开容器 | - |
|
|
131
|
+
| `close` | 关闭容器 | - |
|
|
132
|
+
|
|
133
|
+
---$
|
|
134
|
+
|
|
135
|
+
### 非微信平台兼容差异
|
|
136
|
+
|
|
137
|
+
以下能力在非微信平台基于 `ste-popup` 兼容,无法完全等效原生 `page-container`:
|
|
138
|
+
|
|
139
|
+
- `closeOnSlideDown`:不支持
|
|
140
|
+
- `overlayStyle`:不支持
|
|
141
|
+
- 原生手势与生命周期细节存在实现差异
|
|
142
|
+
|
|
143
|
+
微信端多实例场景说明:
|
|
144
|
+
|
|
145
|
+
- 同一页面第一个 `ste-pate-container` 使用原生 `page-container`
|
|
146
|
+
- 后续实例自动降级为 `ste-popup`,避免触发 `Only one instance can exist` 报错
|
|
147
|
+
|
|
148
|
+
---$
|
|
149
|
+
{{fuyuwei}}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef MP-WEIXIN -->
|
|
3
|
+
<page-container
|
|
4
|
+
v-if="useWxNative"
|
|
5
|
+
:show="show"
|
|
6
|
+
:duration="duration"
|
|
7
|
+
:z-index="zIndex"
|
|
8
|
+
:overlay="overlay"
|
|
9
|
+
:position="position"
|
|
10
|
+
:round="round"
|
|
11
|
+
:close-on-slide-down="closeOnSlideDown"
|
|
12
|
+
:overlay-style="overlayStyle"
|
|
13
|
+
:custom-style="customStyle"
|
|
14
|
+
:safe-area-inset-bottom="safeAreaInsetBottom"
|
|
15
|
+
@beforeenter="emitEvent('beforeenter', $event)"
|
|
16
|
+
@enter="emitEvent('enter', $event)"
|
|
17
|
+
@afterenter="emitEvent('afterenter', $event)"
|
|
18
|
+
@beforeleave="emitEvent('beforeleave', $event)"
|
|
19
|
+
@leave="emitEvent('leave', $event)"
|
|
20
|
+
@afterleave="emitEvent('afterleave', $event)"
|
|
21
|
+
@clickoverlay="onClickOverlay"
|
|
22
|
+
>
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</page-container>
|
|
25
|
+
|
|
26
|
+
<ste-popup
|
|
27
|
+
v-else
|
|
28
|
+
:show.sync="innerShow"
|
|
29
|
+
:duration="duration"
|
|
30
|
+
:zIndex="zIndex"
|
|
31
|
+
:showMask="overlay"
|
|
32
|
+
:position="popupPosition"
|
|
33
|
+
:round="round"
|
|
34
|
+
:isMaskClick="overlay"
|
|
35
|
+
:showClose="false"
|
|
36
|
+
@clickMask="onClickOverlay"
|
|
37
|
+
@open-after="onPopupOpenAfter"
|
|
38
|
+
>
|
|
39
|
+
<view class="ste-pate-container-content" :class="{ 'safe-area-bottom': safeAreaInsetBottom && position === 'bottom' }" :style="customStyle">
|
|
40
|
+
<slot></slot>
|
|
41
|
+
</view>
|
|
42
|
+
</ste-popup>
|
|
43
|
+
<!-- #endif -->
|
|
44
|
+
|
|
45
|
+
<!-- #ifndef MP-WEIXIN -->
|
|
46
|
+
<ste-popup
|
|
47
|
+
:show.sync="innerShow"
|
|
48
|
+
:duration="duration"
|
|
49
|
+
:zIndex="zIndex"
|
|
50
|
+
:showMask="overlay"
|
|
51
|
+
:position="popupPosition"
|
|
52
|
+
:round="round"
|
|
53
|
+
:isMaskClick="overlay"
|
|
54
|
+
:showClose="false"
|
|
55
|
+
@clickMask="onClickOverlay"
|
|
56
|
+
@open-after="onPopupOpenAfter"
|
|
57
|
+
>
|
|
58
|
+
<view class="ste-pate-container-content" :class="{ 'safe-area-bottom': safeAreaInsetBottom && position === 'bottom' }" :style="customStyle">
|
|
59
|
+
<slot></slot>
|
|
60
|
+
</view>
|
|
61
|
+
</ste-popup>
|
|
62
|
+
<!-- #endif -->
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script>
|
|
66
|
+
/**
|
|
67
|
+
* ste-pate-container 页面容器
|
|
68
|
+
* @description 微信小程序下使用原生 page-container,其他平台使用 ste-popup 兼容实现
|
|
69
|
+
* @property {Boolean} show 是否显示容器
|
|
70
|
+
* @property {Number} duration 动画时长,单位 ms
|
|
71
|
+
* @property {Number} zIndex 层级
|
|
72
|
+
* @property {Boolean} overlay 是否显示遮罩
|
|
73
|
+
* @property {String} position 弹出位置,top/bottom/right/center
|
|
74
|
+
* @property {Boolean} round 是否展示圆角
|
|
75
|
+
* @property {Boolean} closeOnSlideDown 是否允许下滑关闭(仅微信小程序)
|
|
76
|
+
* @property {String} overlayStyle 遮罩层样式(仅微信小程序)
|
|
77
|
+
* @property {String} customStyle 容器样式
|
|
78
|
+
* @property {Boolean} safeAreaInsetBottom 是否适配底部安全区
|
|
79
|
+
*/
|
|
80
|
+
export default {
|
|
81
|
+
group: '基础组件',
|
|
82
|
+
title: 'PageContainer 页面容器',
|
|
83
|
+
name: 'ste-pate-container',
|
|
84
|
+
props: {
|
|
85
|
+
show: { type: [Boolean, null], default: false },
|
|
86
|
+
duration: { type: [Number, null], default: 300 },
|
|
87
|
+
zIndex: { type: [Number, String, null], default: 100 },
|
|
88
|
+
overlay: { type: [Boolean, null], default: true },
|
|
89
|
+
position: {
|
|
90
|
+
type: [String, null],
|
|
91
|
+
default: 'bottom',
|
|
92
|
+
validator(value) {
|
|
93
|
+
return ['top', 'bottom', 'right', 'center'].includes(value);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
round: { type: [Boolean, null], default: false },
|
|
97
|
+
closeOnSlideDown: { type: [Boolean, null], default: false },
|
|
98
|
+
overlayStyle: { type: [String, null], default: '' },
|
|
99
|
+
customStyle: { type: [String, null], default: '' },
|
|
100
|
+
safeAreaInsetBottom: { type: [Boolean, null], default: false },
|
|
101
|
+
},
|
|
102
|
+
data() {
|
|
103
|
+
return {
|
|
104
|
+
innerShow: this.show,
|
|
105
|
+
leaveTimer: null,
|
|
106
|
+
useWxNative: false,
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
computed: {
|
|
110
|
+
popupPosition() {
|
|
111
|
+
if (['top', 'bottom', 'right', 'center'].includes(this.position)) {
|
|
112
|
+
return this.position;
|
|
113
|
+
}
|
|
114
|
+
return 'bottom';
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
watch: {
|
|
118
|
+
show(newVal) {
|
|
119
|
+
if (!this.useWxNative) {
|
|
120
|
+
if (this.innerShow !== newVal) {
|
|
121
|
+
this.innerShow = newVal;
|
|
122
|
+
}
|
|
123
|
+
this.triggerTransition(newVal);
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
innerShow(newVal) {
|
|
127
|
+
if (!this.useWxNative && newVal !== this.show) {
|
|
128
|
+
this.$emit('update:show', newVal);
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
beforeDestroy() {
|
|
133
|
+
this.clearTimers();
|
|
134
|
+
this.releaseWxNativeOwner();
|
|
135
|
+
},
|
|
136
|
+
created() {
|
|
137
|
+
this.initMode();
|
|
138
|
+
if (!this.useWxNative && this.show) {
|
|
139
|
+
this.triggerTransition(true);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
methods: {
|
|
143
|
+
getGlobalScope() {
|
|
144
|
+
if (typeof globalThis !== 'undefined') return globalThis;
|
|
145
|
+
if (typeof global !== 'undefined') return global;
|
|
146
|
+
return {};
|
|
147
|
+
},
|
|
148
|
+
initMode() {
|
|
149
|
+
// #ifdef MP-WEIXIN
|
|
150
|
+
const scope = this.getGlobalScope();
|
|
151
|
+
if (!scope.__stePateContainerOwnerUid) {
|
|
152
|
+
scope.__stePateContainerOwnerUid = this._uid;
|
|
153
|
+
this.useWxNative = true;
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.useWxNative = scope.__stePateContainerOwnerUid === this._uid;
|
|
157
|
+
// #endif
|
|
158
|
+
// #ifndef MP-WEIXIN
|
|
159
|
+
this.useWxNative = false;
|
|
160
|
+
// #endif
|
|
161
|
+
},
|
|
162
|
+
releaseWxNativeOwner() {
|
|
163
|
+
// #ifdef MP-WEIXIN
|
|
164
|
+
const scope = this.getGlobalScope();
|
|
165
|
+
if (scope.__stePateContainerOwnerUid === this._uid) {
|
|
166
|
+
scope.__stePateContainerOwnerUid = null;
|
|
167
|
+
}
|
|
168
|
+
// #endif
|
|
169
|
+
},
|
|
170
|
+
emitEvent(eventName, e) {
|
|
171
|
+
this.$emit(eventName, e);
|
|
172
|
+
},
|
|
173
|
+
onClickOverlay(e) {
|
|
174
|
+
this.$emit('clickoverlay', e);
|
|
175
|
+
},
|
|
176
|
+
onPopupOpenAfter(e) {
|
|
177
|
+
this.$emit('afterenter', e);
|
|
178
|
+
},
|
|
179
|
+
open() {
|
|
180
|
+
this.$emit('update:show', true);
|
|
181
|
+
},
|
|
182
|
+
close() {
|
|
183
|
+
this.$emit('update:show', false);
|
|
184
|
+
},
|
|
185
|
+
clearTimers() {
|
|
186
|
+
if (this.leaveTimer) {
|
|
187
|
+
clearTimeout(this.leaveTimer);
|
|
188
|
+
this.leaveTimer = null;
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
triggerTransition(show) {
|
|
192
|
+
this.clearTimers();
|
|
193
|
+
if (show) {
|
|
194
|
+
this.$emit('beforeenter');
|
|
195
|
+
this.$emit('enter');
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this.$emit('beforeleave');
|
|
199
|
+
this.$emit('leave');
|
|
200
|
+
this.leaveTimer = setTimeout(() => {
|
|
201
|
+
this.$emit('afterleave');
|
|
202
|
+
this.leaveTimer = null;
|
|
203
|
+
}, this.duration);
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
</script>
|
|
208
|
+
|
|
209
|
+
<style lang="scss" scoped>
|
|
210
|
+
.ste-pate-container-content {
|
|
211
|
+
width: 100%;
|
|
212
|
+
height: 100%;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.safe-area-bottom {
|
|
216
|
+
padding-bottom: constant(safe-area-inset-bottom);
|
|
217
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
218
|
+
box-sizing: border-box;
|
|
219
|
+
}
|
|
220
|
+
</style>
|
|
@@ -112,22 +112,22 @@ export default {
|
|
|
112
112
|
### API
|
|
113
113
|
#### 组件属性(Props)
|
|
114
114
|
|
|
115
|
-
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
116
|
-
| --- | --- | --- | --- | --- | --- |
|
|
117
|
-
| `show` | 是否显示弹出层,使用`sync`修饰符来双向绑定 | `Boolean` | `false` | - | - |
|
|
118
|
-
| `backGround` | 内容容器的背景色 | `String` | `#ffffff` | - | - |
|
|
119
|
-
| `showMask` | 是否显示遮罩 | `Boolean` | `true` | - | - |
|
|
120
|
-
| `isMaskClick` | 是否可以点击遮罩层关闭 | `Boolean` | `true` | - | - |
|
|
121
|
-
| `width` | 内容区宽度 | `Number/String` | `auto` | - | - |
|
|
122
|
-
| `height` | 内容区高度 | `Number/String` | `auto` | - | - |
|
|
123
|
-
| `position` | 弹出位置 | `String` | `center` | `top` `bottom` `left` `right` | - |
|
|
124
|
-
| `round` | 是否圆角 | `Boolean` | `false` | - | - |
|
|
125
|
-
| `showClose` | 是否右上角显示关闭图标 | `Boolean` | `true` | - | - |
|
|
126
|
-
| `offsetX` | 根据弹出位置,设置X轴偏移量,单位px | `Number/String` | `0` | - | - |
|
|
127
|
-
| `offsetY` | 根据弹出位置,设置Y轴偏移量,单位px | `Number/String` | `0` | - | - |
|
|
128
|
-
| `duration` | 动画持续时间 | `Number` | `200` | - | - |
|
|
129
|
-
| `zIndex` | 弹窗层级z-index | `Number` | `1000` | - | - |
|
|
130
|
-
| `keepContent` | 隐藏后是否不销毁弹窗内容元素 | `Boolean` | `true` | - | `v1.10.1` |
|
|
115
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
116
|
+
| --- | --- | --- | --- | --- | --- |
|
|
117
|
+
| `show` | 是否显示弹出层,使用`sync`修饰符来双向绑定 | `Boolean` | `false` | - | - |
|
|
118
|
+
| `backGround` | 内容容器的背景色 | `String` | `#ffffff` | - | - |
|
|
119
|
+
| `showMask` | 是否显示遮罩 | `Boolean` | `true` | - | - |
|
|
120
|
+
| `isMaskClick` | 是否可以点击遮罩层关闭 | `Boolean` | `true` | - | - |
|
|
121
|
+
| `width` | 内容区宽度 | `Number/String` | `auto` | - | - |
|
|
122
|
+
| `height` | 内容区高度 | `Number/String` | `auto` | - | - |
|
|
123
|
+
| `position` | 弹出位置 | `String` | `center` | `top` `bottom` `left` `right` | - |
|
|
124
|
+
| `round` | 是否圆角 | `Boolean` | `false` | - | - |
|
|
125
|
+
| `showClose` | 是否右上角显示关闭图标 | `Boolean` | `true` | - | - |
|
|
126
|
+
| `offsetX` | 根据弹出位置,设置X轴偏移量,单位px | `Number/String` | `0` | - | - |
|
|
127
|
+
| `offsetY` | 根据弹出位置,设置Y轴偏移量,单位px | `Number/String` | `0` | - | - |
|
|
128
|
+
| `duration` | 动画持续时间 | `Number` | `200` | - | - |
|
|
129
|
+
| `zIndex` | 弹窗层级z-index | `Number` | `1000` | - | - |
|
|
130
|
+
| `keepContent` | 隐藏后是否不销毁弹窗内容元素 | `Boolean` | `true` | - | `v1.10.1` |
|
|
131
131
|
| `appendToBody`| 是否将弹窗挂载到body下(仅H5、APP有效) | `Boolean` | `false` | - | `v1.40.13`|
|
|
132
132
|
|
|
133
133
|
#### 组件事件(Events)
|