stellar-ui-v2 1.40.5 → 1.40.7
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-app-update/README.md +65 -0
- package/components/ste-app-update/config.json +5 -0
- package/components/ste-app-update/method.js +48 -0
- package/components/ste-app-update/ste-app-update.vue +308 -0
- package/components/ste-comment/config.json +4 -4
- package/components/ste-coupon-list/ste-coupon-list.vue +2 -0
- package/components/ste-index-list/README.md +6 -6
- package/components/ste-message-box/ste-message-box.js +72 -72
- package/components/ste-popup/ste-popup.vue +391 -336
- package/components/ste-rate/README.md +13 -13
- package/components/ste-select/datetime.vue +106 -106
- package/components/ste-signature/README.md +2 -1
- package/components/ste-signature/ste-signature.vue +1 -1
- package/components/ste-stepper/README.md +1 -1
- 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/package.json +18 -18
- package/static/app_update_img.png +0 -0
package/README.md
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
## ✨ 特性
|
|
12
12
|
|
|
13
|
-
- 🎯 多平台覆盖,支持 微信小程序、支付宝小程序、H5.
|
|
14
|
-
- 🚀 40+ 个高质量组件,覆盖移动端主流场景.
|
|
15
|
-
- 📖 提供丰富的文档和组件示例.
|
|
13
|
+
- 🎯 多平台覆盖,支持 微信小程序、支付宝小程序、H5.
|
|
14
|
+
- 🚀 40+ 个高质量组件,覆盖移动端主流场景.
|
|
15
|
+
- 📖 提供丰富的文档和组件示例.
|
|
16
16
|
- 🎨 支持修改 CSS 变量实现主题定制.
|
|
17
17
|
|
|
18
18
|
## 📱 预览
|
|
@@ -75,11 +75,11 @@ npm i stellar-ui-v2 -S
|
|
|
75
75
|
|
|
76
76
|
## 周边生态
|
|
77
77
|
|
|
78
|
-
| 项目 | 描述 |
|
|
79
|
-
| --- | --- |
|
|
80
|
-
|[StellarUI-Plus](https://github.com/wuhanshuzhiyun/stellar-ui-plus) | 一个基于vue3构建,打造的uni-app组件库 |
|
|
81
|
-
|[ste-vue-inset-loader](https://github.com/wuhanshuzhiyun/ste-vue-inset-loader) |常用于小程序需要全局引入组件的场景的包 |
|
|
82
|
-
|[ste-helper](https://github.com/wuhanshuzhiyun/stellar-ui-plus/tree/main/plugins/ste-helper) |旨在帮助开发者更加有效率的使用 StellarUI-Plus来开发项目的vscode插件 |
|
|
78
|
+
| 项目 | 描述 |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
|[StellarUI-Plus](https://github.com/wuhanshuzhiyun/stellar-ui-plus) | 一个基于vue3构建,打造的uni-app组件库 |
|
|
81
|
+
|[ste-vue-inset-loader](https://github.com/wuhanshuzhiyun/ste-vue-inset-loader) |常用于小程序需要全局引入组件的场景的包 |
|
|
82
|
+
|[ste-helper](https://github.com/wuhanshuzhiyun/stellar-ui-plus/tree/main/plugins/ste-helper) |旨在帮助开发者更加有效率的使用 StellarUI-Plus来开发项目的vscode插件 |
|
|
83
83
|
|[ste-cli](https://github.com/wuhanshuzhiyun/ste-cli) |stellar配套的脚手架 |
|
|
84
84
|
|
|
85
85
|
## 核心团队
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# AppUpdate App更新
|
|
2
|
+
|
|
3
|
+
此组件用于APP更新功能
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
### 基础用法
|
|
8
|
+
|
|
9
|
+
- 属性`clientId`用于设置APP的应用编码
|
|
10
|
+
- 属性`clientSecret`用于设置APP的应用密钥
|
|
11
|
+
- 函数`start`用于开始检查更新
|
|
12
|
+
- 回调事`cancel`取消更新
|
|
13
|
+
- 回调事`complete`取消,成功更新都会执行
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
name: 'AppUpdateDemo',
|
|
19
|
+
data() {
|
|
20
|
+
return {};
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
// 监听检查更新结果
|
|
24
|
+
checkForUpdates() {
|
|
25
|
+
if (this.$refs.appUpdate) {
|
|
26
|
+
this.$refs.appUpdate.start((resVersion, version) => {
|
|
27
|
+
const { code, name } = resVersion;
|
|
28
|
+
console.log(`当前版本号:${version}`);
|
|
29
|
+
console.log(`服务器版本号:${code};服务器版本名称${name}`);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
<template>
|
|
37
|
+
<ste-app-update ref="appUpdate" clientId="workbench_android" clientSecret="gkS6lEEncqAocYK2qsrvPQZykm3ISeMx"></ste-app-update>
|
|
38
|
+
<button @click="checkForUpdates">检查更新</button>
|
|
39
|
+
</template>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---$
|
|
43
|
+
|
|
44
|
+
### API
|
|
45
|
+
|
|
46
|
+
#### Props
|
|
47
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
48
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
49
|
+
| `clientId` | 应用编码 | `string` | `` | - | - |
|
|
50
|
+
| `clientSecret` | 应用密钥 | `string` | `` | - | - |
|
|
51
|
+
| `apiUrl` | 更新API地址 | `string` | `https://zboa.whzb.com/inte-cloud-dev/blade-system/api/inte/client/ver/currentDetail` | - | - |
|
|
52
|
+
| `appType` | APP环境,版本号的最后一位为环境标识 | `string` | `` | - | - |
|
|
53
|
+
| `btnText` | 立即体验按钮文本 | `string` | `立即体验` | - | - |
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
#### Events
|
|
57
|
+
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
58
|
+
| ----- | ----- | ------- | -------- |
|
|
59
|
+
| `cancel` | 取消更新 | - | - |
|
|
60
|
+
| `update` | 发现新版时本触发 | - | - |
|
|
61
|
+
| `no-update` | 没有新版时本触发 | - | - |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
---$
|
|
65
|
+
{{xuyajun}}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function download(data, { success, error, onProgressUpdate, downloadSuccess }) {
|
|
2
|
+
const package_type = data.package_type;
|
|
3
|
+
const downloadTask = uni.downloadFile({
|
|
4
|
+
url: data.updateFile,
|
|
5
|
+
success: (res) => {
|
|
6
|
+
if (res.statusCode === 200) {
|
|
7
|
+
downloadSuccess && downloadSuccess(res.tempFilePath);
|
|
8
|
+
plus.runtime.install(
|
|
9
|
+
res.tempFilePath,
|
|
10
|
+
{ force: true },
|
|
11
|
+
() => {
|
|
12
|
+
// wgt升级
|
|
13
|
+
if (package_type == 1) {
|
|
14
|
+
uni.showModal({
|
|
15
|
+
title: '提示',
|
|
16
|
+
content: '升级成功,请重新启动!',
|
|
17
|
+
confirmText: '确定',
|
|
18
|
+
showCancel: false,
|
|
19
|
+
success: () => {
|
|
20
|
+
success && success();
|
|
21
|
+
plus.runtime.restart();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
// 整包升级
|
|
26
|
+
success && success();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
(e) => {
|
|
30
|
+
//提示部分wgt包无法安装的问题
|
|
31
|
+
uni.showModal({
|
|
32
|
+
title: '提示',
|
|
33
|
+
content: e.message,
|
|
34
|
+
showCancel: false,
|
|
35
|
+
success: () => {
|
|
36
|
+
error && error(e);
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
// 下载进度
|
|
45
|
+
downloadTask.onProgressUpdate((res) => {
|
|
46
|
+
onProgressUpdate && onProgressUpdate(res);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="update-mask flex-center" v-if="open">
|
|
3
|
+
<view class="update-content">
|
|
4
|
+
<image class="update-image" src="../../static/app_update_img.png"></image>
|
|
5
|
+
|
|
6
|
+
<view class="update-title">发现新版本</view>
|
|
7
|
+
<view class="update-version">v{{ data.name }}</view>
|
|
8
|
+
<scroll-view scroll-y class="update-desc">
|
|
9
|
+
<view class="update-desc-title">更新内容</view>
|
|
10
|
+
<view class="update-desc-message"><rich-text :nodes="data.content"></rich-text></view>
|
|
11
|
+
</scroll-view>
|
|
12
|
+
<view class="update-footer">
|
|
13
|
+
<view class="update-progress-box" v-if="!updateBtn">
|
|
14
|
+
<progress class="update-progress" border-radius="35" :percent="percent" activeColor="#3DA7FF" show-info stroke-width="10" />
|
|
15
|
+
<view>
|
|
16
|
+
<text class="update-down-msg" v-if="tempFilePath">下载完成</text>
|
|
17
|
+
<text class="update-down-msg" v-else>正在下载,请稍后 ({{ downloadedSize }}/{{ packageFileSize }}M)</text>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
<button class="update-button" plain @click="confirm" v-if="updateBtn">{{ btnText }}</button>
|
|
21
|
+
<button class="update-button" plain @click="install" v-else-if="data.package_type === 0 && tempFilePath">安装</button>
|
|
22
|
+
</view>
|
|
23
|
+
|
|
24
|
+
<view class="update-close" v-if="!data.isForce" @click.stop="close">✖</view>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
</template>
|
|
28
|
+
<script>
|
|
29
|
+
import { download } from './method';
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
group: '业务组件',
|
|
33
|
+
title: 'AppUpdate APP更新',
|
|
34
|
+
name: 'SteAppUpdate',
|
|
35
|
+
props: {
|
|
36
|
+
/** 应用编码 */
|
|
37
|
+
clientId: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: '',
|
|
40
|
+
},
|
|
41
|
+
/** 应用密钥 */
|
|
42
|
+
clientSecret: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
/** API地址 */
|
|
47
|
+
apiUrl: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: 'https://zboa.whzb.com/inte-cloud-dev/blade-system/api/inte/client/ver/currentDetail',
|
|
50
|
+
},
|
|
51
|
+
/** APP环境,版本号的最后一位为环境标识 */
|
|
52
|
+
appType: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: '',
|
|
55
|
+
},
|
|
56
|
+
/** 立即体验按钮文本 */
|
|
57
|
+
btnText: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: '立即体验',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
data() {
|
|
63
|
+
return {
|
|
64
|
+
data: {
|
|
65
|
+
content: '',
|
|
66
|
+
updateFile: '', //安装包
|
|
67
|
+
isForce: false, //是否强制更新 0代表否 1代表是
|
|
68
|
+
package_type: 0, //0 是整包升级 1是wgt升级
|
|
69
|
+
name: '1.0.1', // 版本名称
|
|
70
|
+
code: '100', // 版本号
|
|
71
|
+
},
|
|
72
|
+
open: false,
|
|
73
|
+
version: uni.getSystemInfoSync().version,
|
|
74
|
+
percent: 0,
|
|
75
|
+
updateBtn: true,
|
|
76
|
+
downloadedSize: '0',
|
|
77
|
+
packageFileSize: '0',
|
|
78
|
+
tempFilePath: '',
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
methods: {
|
|
82
|
+
getData(callback) {
|
|
83
|
+
uni.request({
|
|
84
|
+
url: this.apiUrl,
|
|
85
|
+
method: 'GET',
|
|
86
|
+
header: {
|
|
87
|
+
Authorization: `Basic ${btoa(this.clientId + ':' + this.clientSecret)}`,
|
|
88
|
+
},
|
|
89
|
+
success: (res) => {
|
|
90
|
+
const _data = res.data;
|
|
91
|
+
if (_data.code == 200) {
|
|
92
|
+
this.data.code = _data.data.code;
|
|
93
|
+
this.data.name = _data.data.name;
|
|
94
|
+
|
|
95
|
+
this.data.content = (_data.data.desc || '').replace(/\n+/g, '<br />');
|
|
96
|
+
|
|
97
|
+
this.data.isForce = _data.data.isForce;
|
|
98
|
+
this.data.updateFile = _data.data.entireFile ? _data.data.entireFile : _data.data.updateFile;
|
|
99
|
+
this.data.package_type = _data.data.entireFile ? 0 : 1;
|
|
100
|
+
callback && callback({ code: _data.data.code, name: _data.data.name, updateFile: this.data.updateFile }, this.version);
|
|
101
|
+
if (this.appType) {
|
|
102
|
+
const nvs = this.data.name.split('.');
|
|
103
|
+
// 版本号的最后一位是环境,比较版本号最后一位版本号是否一致,不一致弹错误窗口提示
|
|
104
|
+
const nevn = nvs[nvs.length - 1];
|
|
105
|
+
if (this.appType !== nevn) {
|
|
106
|
+
uni.showModal({
|
|
107
|
+
title: '提示',
|
|
108
|
+
content: `新版本环境:${nevn}和当前环境${this.appType}不一致`,
|
|
109
|
+
showCancel: false,
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
nvs.splice(nvs.length - 1);
|
|
114
|
+
this.data.name = nvs.join('.');
|
|
115
|
+
}
|
|
116
|
+
if (this.data.updateFile && this.data.code !== this.version) {
|
|
117
|
+
this.open = true;
|
|
118
|
+
this.$emit('update');
|
|
119
|
+
// 如果是强制更新,直接开始下载
|
|
120
|
+
if (this.data.isForce) this.confirm();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
console.log(_data.msg);
|
|
125
|
+
}
|
|
126
|
+
// 无需升级
|
|
127
|
+
this.$emit('no-update');
|
|
128
|
+
},
|
|
129
|
+
fail: (err) => {
|
|
130
|
+
console.log('err===========', err);
|
|
131
|
+
this.$emit('no-update');
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
start(callback) {
|
|
137
|
+
// #ifdef APP-PLUS
|
|
138
|
+
plus.runtime.getProperty(plus.runtime.appid || '', (inf) => {
|
|
139
|
+
this.version = inf.version || '';
|
|
140
|
+
this.getData(callback);
|
|
141
|
+
});
|
|
142
|
+
// #endif
|
|
143
|
+
// #ifndef APP-PLUS
|
|
144
|
+
this.getData(callback);
|
|
145
|
+
// #endif
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
onProgressUpdate(res) {
|
|
149
|
+
this.percent = res.progress;
|
|
150
|
+
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
|
|
151
|
+
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
confirm() {
|
|
155
|
+
if (this.data.package_type == 0) {
|
|
156
|
+
//apk整包升级 下载地址必须以.apk结尾
|
|
157
|
+
if (this.data.updateFile.includes('.apk')) {
|
|
158
|
+
this.updateBtn = false;
|
|
159
|
+
download(this.data, {
|
|
160
|
+
onProgressUpdate: this.onProgressUpdate,
|
|
161
|
+
downloadSuccess: (path) => (this.tempFilePath = path),
|
|
162
|
+
});
|
|
163
|
+
} else {
|
|
164
|
+
//外部下载 一般是手机应用市场或者其他h5页面
|
|
165
|
+
plus.runtime.openURL(this.data.updateFile);
|
|
166
|
+
uni.navigateBack({
|
|
167
|
+
delta: 1,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
this.updateBtn = false;
|
|
172
|
+
//wgt资源包升级 下载地址必须以.wgt结尾
|
|
173
|
+
download(this.data, {
|
|
174
|
+
onProgressUpdate: this.onProgressUpdate,
|
|
175
|
+
downloadSuccess: (path) => (this.tempFilePath = path),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
close() {
|
|
181
|
+
this.open = false;
|
|
182
|
+
this.$emit('cancel');
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
install() {
|
|
186
|
+
plus.runtime.install(
|
|
187
|
+
this.tempFilePath,
|
|
188
|
+
{ force: true },
|
|
189
|
+
() => {
|
|
190
|
+
// wgt升级
|
|
191
|
+
if (this.data.package_type == 1) {
|
|
192
|
+
uni.showModal({
|
|
193
|
+
title: '提示',
|
|
194
|
+
content: '升级成功,请重新启动!',
|
|
195
|
+
confirmText: '确定',
|
|
196
|
+
showCancel: false,
|
|
197
|
+
success: () => {
|
|
198
|
+
plus.runtime.restart();
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
(e) => {
|
|
204
|
+
//提示部分wgt包无法安装的问题
|
|
205
|
+
uni.showModal({
|
|
206
|
+
title: '提示',
|
|
207
|
+
content: e.message,
|
|
208
|
+
showCancel: false,
|
|
209
|
+
success: () => {},
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
);
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
</script>
|
|
217
|
+
|
|
218
|
+
<style lang="scss" scoped>
|
|
219
|
+
.flex-center {
|
|
220
|
+
display: flex;
|
|
221
|
+
justify-content: center;
|
|
222
|
+
align-items: center;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.update-mask {
|
|
226
|
+
position: fixed;
|
|
227
|
+
left: 0;
|
|
228
|
+
top: 0;
|
|
229
|
+
right: 0;
|
|
230
|
+
bottom: 0;
|
|
231
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
232
|
+
z-index: 9999;
|
|
233
|
+
.update-content {
|
|
234
|
+
width: 694rpx;
|
|
235
|
+
background-color: #fff;
|
|
236
|
+
border-radius: 16rpx;
|
|
237
|
+
padding: 72rpx 40rpx 40rpx 40rpx;
|
|
238
|
+
display: flex;
|
|
239
|
+
flex-direction: column;
|
|
240
|
+
align-items: center;
|
|
241
|
+
line-height: 1.5;
|
|
242
|
+
position: relative;
|
|
243
|
+
.update-image {
|
|
244
|
+
width: 201rpx;
|
|
245
|
+
height: 201rpx;
|
|
246
|
+
}
|
|
247
|
+
.update-title {
|
|
248
|
+
margin-top: 28rpx;
|
|
249
|
+
font-weight: 500;
|
|
250
|
+
font-size: 48rpx;
|
|
251
|
+
color: #000000;
|
|
252
|
+
}
|
|
253
|
+
.update-version {
|
|
254
|
+
font-weight: 400;
|
|
255
|
+
font-size: 34rpx;
|
|
256
|
+
color: #a7abb0;
|
|
257
|
+
}
|
|
258
|
+
.update-desc {
|
|
259
|
+
width: 100%;
|
|
260
|
+
max-height: 350rpx;
|
|
261
|
+
margin-top: 24rpx;
|
|
262
|
+
.update-desc-title {
|
|
263
|
+
font-weight: 500;
|
|
264
|
+
font-size: 32rpx;
|
|
265
|
+
color: #000000;
|
|
266
|
+
}
|
|
267
|
+
.update-desc-message {
|
|
268
|
+
font-weight: 400;
|
|
269
|
+
font-size: 28rpx;
|
|
270
|
+
color: #555a61;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.update-footer {
|
|
275
|
+
width: 100%;
|
|
276
|
+
margin-top: 48rpx;
|
|
277
|
+
.update-progress-box {
|
|
278
|
+
text-align: center;
|
|
279
|
+
font-weight: 400;
|
|
280
|
+
font-size: 34rpx;
|
|
281
|
+
color: #a7abb0;
|
|
282
|
+
}
|
|
283
|
+
.update-button {
|
|
284
|
+
width: 100%;
|
|
285
|
+
height: 96rpx;
|
|
286
|
+
line-height: 88rpx;
|
|
287
|
+
background: #1388f7;
|
|
288
|
+
border-radius: 16rpx;
|
|
289
|
+
border: 4rpx solid #1388f7;
|
|
290
|
+
font-weight: 500;
|
|
291
|
+
font-size: 32rpx;
|
|
292
|
+
color: #ffffff;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
.update-close {
|
|
296
|
+
position: absolute;
|
|
297
|
+
top: 0;
|
|
298
|
+
right: 0;
|
|
299
|
+
font-size: 30rpx;
|
|
300
|
+
color: #555a61;
|
|
301
|
+
width: 104rpx;
|
|
302
|
+
height: 96rpx;
|
|
303
|
+
line-height: 96rpx;
|
|
304
|
+
text-align: center;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
"group": "业务组件",
|
|
3
|
+
"title": "Comment 评价",
|
|
4
|
+
"icon": "https://image.whzb.com/chain/StellarUI/组件图标/评价.png"
|
|
5
|
+
}
|
|
@@ -111,12 +111,12 @@ methods: {
|
|
|
111
111
|
|
|
112
112
|
#### IndexList Props
|
|
113
113
|
|
|
114
|
-
| 属性名 | 说明 |类型 |默认值 |可选值 | 支持版本 |
|
|
115
|
-
| --- |--- | --- | --- | --- | --- |
|
|
116
|
-
| `active` | 当前激活的索引下标,支持sync双向绑定,默认值0 | `Number` | `0` | - | - |
|
|
117
|
-
| `height` | 高度,默认值100% | `String`/`Number` | `"100%"` | - | - |
|
|
118
|
-
| `sticky` | `title`是否粘性布局,自定义`title`插槽时不生效 | `Boolean` | `true` | - | - |
|
|
119
|
-
| `inactiveColor` | 右边锚点状态非激活时的颜色 | `String` | `#666666` | - | - |
|
|
114
|
+
| 属性名 | 说明 |类型 |默认值 |可选值 | 支持版本 |
|
|
115
|
+
| --- |--- | --- | --- | --- | --- |
|
|
116
|
+
| `active` | 当前激活的索引下标,支持sync双向绑定,默认值0 | `Number` | `0` | - | - |
|
|
117
|
+
| `height` | 高度,默认值100% | `String`/`Number` | `"100%"` | - | - |
|
|
118
|
+
| `sticky` | `title`是否粘性布局,自定义`title`插槽时不生效 | `Boolean` | `true` | - | - |
|
|
119
|
+
| `inactiveColor` | 右边锚点状态非激活时的颜色 | `String` | `#666666` | - | - |
|
|
120
120
|
| `activeColor` | 右边锚点状态激活时的颜色 | `String` | `#0090FF` | - | - |
|
|
121
121
|
|
|
122
122
|
#### IndexList Events
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
2
|
-
import Vuex from 'vuex';
|
|
3
|
-
|
|
4
|
-
Vue.use(Vuex);
|
|
5
|
-
const DEFAULT_KEY = '$steMsgBoxKey';
|
|
6
|
-
const DEFAULT_CONFIG = {
|
|
7
|
-
title: '',
|
|
8
|
-
content: '',
|
|
9
|
-
showCancel: true,
|
|
10
|
-
icon: '',
|
|
11
|
-
cancelText: '取消',
|
|
12
|
-
cancelColor: '#333333',
|
|
13
|
-
confirmText: '确认',
|
|
14
|
-
confirmColor: '',
|
|
15
|
-
editable: false,
|
|
16
|
-
placeholderText: '',
|
|
17
|
-
success: null,
|
|
18
|
-
fail: null,
|
|
19
|
-
complete: null,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const store = new Vuex.Store({
|
|
23
|
-
state: {},
|
|
24
|
-
mutations: {
|
|
25
|
-
initializeState(state, key) {
|
|
26
|
-
if (!state[key]) {
|
|
27
|
-
Vue.set(state, key, {
|
|
28
|
-
selector: key,
|
|
29
|
-
openBegin: false,
|
|
30
|
-
...DEFAULT_CONFIG,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
setState(state, { key, params }) {
|
|
35
|
-
Object.assign(state[key], params);
|
|
36
|
-
},
|
|
37
|
-
resetState(state, key) {
|
|
38
|
-
Object.assign(state[key], {
|
|
39
|
-
openBegin: false,
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
function useSteMsgBox(key) {
|
|
46
|
-
key = key ?? DEFAULT_KEY;
|
|
47
|
-
store.commit('initializeState', key);
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
showMsgBox(params) {
|
|
51
|
-
store.commit('setState', {
|
|
52
|
-
key,
|
|
53
|
-
params: {
|
|
54
|
-
...DEFAULT_CONFIG,
|
|
55
|
-
...params,
|
|
56
|
-
confirm: params.confirm ?? function () {},
|
|
57
|
-
cancel: params.cancel ?? function () {},
|
|
58
|
-
complete: params.complete ?? function () {},
|
|
59
|
-
openBegin: true,
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
hideMsgBox() {
|
|
64
|
-
store.commit('resetState', key);
|
|
65
|
-
},
|
|
66
|
-
$state: store.state[key],
|
|
67
|
-
$store: store,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export default useSteMsgBox;
|
|
72
|
-
export { DEFAULT_KEY };
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import Vuex from 'vuex';
|
|
3
|
+
|
|
4
|
+
Vue.use(Vuex);
|
|
5
|
+
const DEFAULT_KEY = '$steMsgBoxKey';
|
|
6
|
+
const DEFAULT_CONFIG = {
|
|
7
|
+
title: '',
|
|
8
|
+
content: '',
|
|
9
|
+
showCancel: true,
|
|
10
|
+
icon: '',
|
|
11
|
+
cancelText: '取消',
|
|
12
|
+
cancelColor: '#333333',
|
|
13
|
+
confirmText: '确认',
|
|
14
|
+
confirmColor: '',
|
|
15
|
+
editable: false,
|
|
16
|
+
placeholderText: '',
|
|
17
|
+
success: null,
|
|
18
|
+
fail: null,
|
|
19
|
+
complete: null,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const store = new Vuex.Store({
|
|
23
|
+
state: {},
|
|
24
|
+
mutations: {
|
|
25
|
+
initializeState(state, key) {
|
|
26
|
+
if (!state[key]) {
|
|
27
|
+
Vue.set(state, key, {
|
|
28
|
+
selector: key,
|
|
29
|
+
openBegin: false,
|
|
30
|
+
...DEFAULT_CONFIG,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
setState(state, { key, params }) {
|
|
35
|
+
Object.assign(state[key], params);
|
|
36
|
+
},
|
|
37
|
+
resetState(state, key) {
|
|
38
|
+
Object.assign(state[key], {
|
|
39
|
+
openBegin: false,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
function useSteMsgBox(key) {
|
|
46
|
+
key = key ?? DEFAULT_KEY;
|
|
47
|
+
store.commit('initializeState', key);
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
showMsgBox(params) {
|
|
51
|
+
store.commit('setState', {
|
|
52
|
+
key,
|
|
53
|
+
params: {
|
|
54
|
+
...DEFAULT_CONFIG,
|
|
55
|
+
...params,
|
|
56
|
+
confirm: params.confirm ?? function () {},
|
|
57
|
+
cancel: params.cancel ?? function () {},
|
|
58
|
+
complete: params.complete ?? function () {},
|
|
59
|
+
openBegin: true,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
hideMsgBox() {
|
|
64
|
+
store.commit('resetState', key);
|
|
65
|
+
},
|
|
66
|
+
$state: store.state[key],
|
|
67
|
+
$store: store,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default useSteMsgBox;
|
|
72
|
+
export { DEFAULT_KEY };
|