uni-oaview 1.0.2 → 1.0.4
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/components/oa-helloworld/oa-helloworld.vue +5 -1
- package/components/oa-image/oa-image.vue +9 -0
- package/components/oa-login/oa-login.vue +119 -0
- package/components/oa-single-select/oa-single-select.vue +127 -0
- package/components/oa-skeleton/oa-skeleton.scss +1 -0
- package/components/oa-skeleton/oa-skeleton.vue +27 -3
- package/components/oa-vconsole/oa-vconsole.vue +7 -2
- package/dist/index.d.ts +10 -1
- package/dist/index.umd.mini.js +24 -0
- package/package.json +3 -2
- package/components/oa-skeleton/skeleton.scss +0 -52
- package/components/oa-skeleton/skeleton.vue +0 -104
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>hello world</div>
|
|
2
|
+
<div>hello world{{ a }}</div>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script lang="ts" setup>
|
|
6
|
+
import { ref } from 'vue';
|
|
7
|
+
import { getAsk } from '../../src';
|
|
8
|
+
|
|
6
9
|
console.log('hello world');
|
|
10
|
+
const a = ref(getAsk());
|
|
7
11
|
</script>
|
|
8
12
|
<style scoped lang="scss"></style>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view style="padding: 0 45px">
|
|
3
|
+
<uni-forms :modelValue="formData" ref="formRef" :rules="rules">
|
|
4
|
+
<uni-forms-item required label="用户名" name="username">
|
|
5
|
+
<uni-easyinput type="text" v-model="formData.username" placeholder="请输入用户名" />
|
|
6
|
+
</uni-forms-item>
|
|
7
|
+
<uni-forms-item required name="password" label="密码">
|
|
8
|
+
<uni-easyinput type="password" v-model="formData.password" placeholder="请输入用户名" />
|
|
9
|
+
</uni-forms-item>
|
|
10
|
+
<uni-forms-item name="verificationCode" label="验证码">
|
|
11
|
+
<uni-easyinput type="text" v-model="formData.verificationCode" placeholder="请输入验证码" />
|
|
12
|
+
</uni-forms-item>
|
|
13
|
+
<view style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px">
|
|
14
|
+
<img :src="imageSrc" alt="" />
|
|
15
|
+
<button @click="refresh" type="primary" size="mini" style="margin: 0">刷新</button>
|
|
16
|
+
</view>
|
|
17
|
+
</uni-forms>
|
|
18
|
+
<button @click="submitForm" type="primary">登录</button>
|
|
19
|
+
</view>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { requestInstance } from '@/requests';
|
|
24
|
+
import { ref, reactive } from 'vue';
|
|
25
|
+
const formRef = ref();
|
|
26
|
+
const formData = reactive({
|
|
27
|
+
username: 'lixd',
|
|
28
|
+
password:
|
|
29
|
+
'f0d5937ddef983a4fbf56eec5c84ab78e7402fd6b55b8b7271f75f676b57bae1afe09a476702f414c12b5259899db3790ab1d8915827f2f956f48c8ab4af7541',
|
|
30
|
+
verificationCode: 88,
|
|
31
|
+
});
|
|
32
|
+
const rules = ref({
|
|
33
|
+
username: [
|
|
34
|
+
{
|
|
35
|
+
required: true,
|
|
36
|
+
errorMessage: '请输入姓名',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
password: [
|
|
40
|
+
{
|
|
41
|
+
required: true,
|
|
42
|
+
errorMessage: '请输入密码',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
const imageSrc = ref('');
|
|
47
|
+
const ppid = ref();
|
|
48
|
+
let baseUrl = '';
|
|
49
|
+
/** 在真机模拟调试的时候运行 */
|
|
50
|
+
// #ifndef H5
|
|
51
|
+
baseUrl = uni.getStorageSync('baseUrl');
|
|
52
|
+
// #endif
|
|
53
|
+
const refresh = () => {
|
|
54
|
+
uni.request({
|
|
55
|
+
url: `${baseUrl}/api/auth/verification/get?t=${Date.now()}`,
|
|
56
|
+
method: 'POST',
|
|
57
|
+
success: (res: any) => {
|
|
58
|
+
const { pid, image } = res.data.data;
|
|
59
|
+
imageSrc.value = image;
|
|
60
|
+
ppid.value = pid;
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
refresh();
|
|
65
|
+
const submitForm = () => {
|
|
66
|
+
uni.showLoading({
|
|
67
|
+
title: '加载中',
|
|
68
|
+
mask: true,
|
|
69
|
+
});
|
|
70
|
+
uni.request({
|
|
71
|
+
url: `${baseUrl}/api/auth/user/login?t=${Date.now()}`,
|
|
72
|
+
method: 'POST',
|
|
73
|
+
data: {
|
|
74
|
+
username: formData.username,
|
|
75
|
+
password: formData.password,
|
|
76
|
+
verification: {
|
|
77
|
+
code: formData.verificationCode,
|
|
78
|
+
pid: ppid.value,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
success: (res: any) => {
|
|
82
|
+
const { uuid: id, email, ...otherParams } = res.data.data;
|
|
83
|
+
const opinions = uni.getStorageSync('opinions');
|
|
84
|
+
opinions.userInfo = {
|
|
85
|
+
...opinions.userInfo,
|
|
86
|
+
id,
|
|
87
|
+
email,
|
|
88
|
+
...otherParams,
|
|
89
|
+
department: '这是一个很长很长的部门部门321312321312',
|
|
90
|
+
position: '这是一个很长很长的职位321312312321321312',
|
|
91
|
+
};
|
|
92
|
+
uni.setStorageSync('opinions', opinions);
|
|
93
|
+
uni.request({
|
|
94
|
+
url: `${baseUrl}/api/gatewayproxy/routing/getToken?t=${Date.now()}`,
|
|
95
|
+
method: 'POST',
|
|
96
|
+
success: (res: any) => {
|
|
97
|
+
uni.hideLoading();
|
|
98
|
+
uni.setStorageSync('token', res.data.data);
|
|
99
|
+
requestInstance.setParams({ token: res.data.data });
|
|
100
|
+
uni.showToast({
|
|
101
|
+
title: '登录成功',
|
|
102
|
+
});
|
|
103
|
+
const currentPages = getCurrentPages();
|
|
104
|
+
let page = currentPages.pop();
|
|
105
|
+
while (currentPages.length && page?.route === 'pages/mock/index') {
|
|
106
|
+
page = currentPages.pop();
|
|
107
|
+
}
|
|
108
|
+
uni.redirectTo({
|
|
109
|
+
url: '/pages/qiandao/index',
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
complete: () => {
|
|
115
|
+
uni.hideLoading();
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
</script>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view>
|
|
3
|
+
<u-popup :show="modelValue" mode="bottom" @close="closeHandler" :closeOnClickOverlay="false">
|
|
4
|
+
<view class="button-box">
|
|
5
|
+
<view class="button-box-left" @click="closeHandler">取消</view>
|
|
6
|
+
<view class="button-box-center">{{ title }}</view>
|
|
7
|
+
<view class="button-box-right" @click="submit">确定</view>
|
|
8
|
+
</view>
|
|
9
|
+
<view class="search-box">
|
|
10
|
+
<view class="search-box-item">
|
|
11
|
+
<picker-view :indicator-style="indicatorStyle" :value="indexList" @change="bindChange" class="picker-view">
|
|
12
|
+
<picker-view-column>
|
|
13
|
+
<view class="item" v-for="(item, index) in columns" :key="index">{{ item[labelKey ?? 'label'] }}</view>
|
|
14
|
+
</picker-view-column>
|
|
15
|
+
</picker-view>
|
|
16
|
+
</view>
|
|
17
|
+
</view>
|
|
18
|
+
</u-popup>
|
|
19
|
+
</view>
|
|
20
|
+
</template>
|
|
21
|
+
<script lang="ts" setup>
|
|
22
|
+
import { createDebounceFn } from '../../src/index';
|
|
23
|
+
import { ref, nextTick, watch, watchEffect } from 'vue';
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
title?: string;
|
|
26
|
+
value?: string;
|
|
27
|
+
modelValue: boolean;
|
|
28
|
+
columns: Array<string>;
|
|
29
|
+
labelKey?: string;
|
|
30
|
+
valueKey?: string;
|
|
31
|
+
}>();
|
|
32
|
+
const title = ref(props.title);
|
|
33
|
+
const indicatorStyle = `height: 40px;`;
|
|
34
|
+
const emit = defineEmits(['updateValue', 'close', 'update:modelValue']);
|
|
35
|
+
const indexList = ref<number[]>([]);
|
|
36
|
+
let currentValue: string;
|
|
37
|
+
watchEffect(() => {
|
|
38
|
+
currentValue = props.value as string;
|
|
39
|
+
});
|
|
40
|
+
const init = () => {
|
|
41
|
+
const index = Math.max(
|
|
42
|
+
0,
|
|
43
|
+
props.columns.findIndex((item) => item[props.valueKey ?? 'value'] === currentValue),
|
|
44
|
+
);
|
|
45
|
+
indexList.value = [index];
|
|
46
|
+
};
|
|
47
|
+
init();
|
|
48
|
+
const bindChange = createDebounceFn((e: any) => {
|
|
49
|
+
const val = e.detail.value;
|
|
50
|
+
nextTick(() => {
|
|
51
|
+
indexList.value = val;
|
|
52
|
+
});
|
|
53
|
+
}, 200);
|
|
54
|
+
const submit = () => {
|
|
55
|
+
const val = indexList.value;
|
|
56
|
+
const newValue = props.columns[val[0]];
|
|
57
|
+
currentValue = newValue[props.valueKey ?? 'value'];
|
|
58
|
+
emit('updateValue', newValue);
|
|
59
|
+
emit('update:modelValue', false);
|
|
60
|
+
emit('close');
|
|
61
|
+
};
|
|
62
|
+
const closeHandler = () => {
|
|
63
|
+
emit('update:modelValue', false);
|
|
64
|
+
emit('close');
|
|
65
|
+
};
|
|
66
|
+
watch(
|
|
67
|
+
() => props.modelValue,
|
|
68
|
+
() => {
|
|
69
|
+
if (props.modelValue) {
|
|
70
|
+
init();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
);
|
|
74
|
+
</script>
|
|
75
|
+
<style lang="scss" scoped>
|
|
76
|
+
.button-box {
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: space-between;
|
|
79
|
+
font-size: 28rpx;
|
|
80
|
+
height: 58px;
|
|
81
|
+
text-align: center;
|
|
82
|
+
line-height: 36px;
|
|
83
|
+
margin: 20rpx 20rpx 0 20rpx;
|
|
84
|
+
&-left {
|
|
85
|
+
height: 36px;
|
|
86
|
+
font-size: 16px;
|
|
87
|
+
color: #909193;
|
|
88
|
+
}
|
|
89
|
+
&-center {
|
|
90
|
+
height: 36px;
|
|
91
|
+
font-size: 16px;
|
|
92
|
+
color: #19242c;
|
|
93
|
+
}
|
|
94
|
+
&-right {
|
|
95
|
+
height: 36px;
|
|
96
|
+
font-size: 16px;
|
|
97
|
+
color: #119af5;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.search-box {
|
|
101
|
+
padding: 24rpx 24rpx 0;
|
|
102
|
+
&-item {
|
|
103
|
+
margin: 12rpx;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
&-title {
|
|
106
|
+
height: 40rpx;
|
|
107
|
+
line-height: 40rpx;
|
|
108
|
+
font-size: 28rpx;
|
|
109
|
+
color: #333333;
|
|
110
|
+
}
|
|
111
|
+
.picker-view {
|
|
112
|
+
width: 100%;
|
|
113
|
+
height: 400rpx;
|
|
114
|
+
.flex-two {
|
|
115
|
+
flex: 2;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
.item {
|
|
119
|
+
height: 40px;
|
|
120
|
+
line-height: 40px;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
text-align: center;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
<view>
|
|
3
3
|
<!-- 为了解决H5中v-if导致样式失效的问题,故使用v-show -->
|
|
4
4
|
<view v-show="loading">
|
|
5
|
-
<view
|
|
5
|
+
<view
|
|
6
|
+
class="skeleton"
|
|
7
|
+
:style="{ 'padding-top': paddingTop, 'padding-bottom': paddingBottom }"
|
|
8
|
+
:class="{ animate: animate }"
|
|
9
|
+
>
|
|
6
10
|
<view
|
|
7
11
|
v-if="displayAvatar"
|
|
8
12
|
class="skeleton-avatar"
|
|
@@ -16,7 +20,7 @@
|
|
|
16
20
|
v-for="(item, index) in rowList"
|
|
17
21
|
:key="index"
|
|
18
22
|
class="skeleton-row-item"
|
|
19
|
-
:style="{ width: item.width, height: rowHeight }"
|
|
23
|
+
:style="{ 'width': item.width, 'height': rowHeight, 'border-radius': borderRadius }"
|
|
20
24
|
></view>
|
|
21
25
|
</view>
|
|
22
26
|
</view>
|
|
@@ -56,11 +60,31 @@
|
|
|
56
60
|
type: String as PropType<'square' | 'round'>,
|
|
57
61
|
default: '',
|
|
58
62
|
},
|
|
63
|
+
rowWidth: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: () => '100%',
|
|
66
|
+
},
|
|
67
|
+
lastRowWidth: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: () => '100%',
|
|
70
|
+
},
|
|
71
|
+
borderRadius: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: () => '0',
|
|
74
|
+
},
|
|
75
|
+
paddingTop: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: () => '16rpx',
|
|
78
|
+
},
|
|
79
|
+
paddingBottom: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: () => '16rpx',
|
|
82
|
+
},
|
|
59
83
|
});
|
|
60
84
|
const rowList = computed(() => {
|
|
61
85
|
const arr: Array<any> = [];
|
|
62
86
|
for (let i = 0; i < props.row; i++) {
|
|
63
|
-
arr.push({ width: i === props.row - 1 && i !== 0 ?
|
|
87
|
+
arr.push({ width: i === props.row - 1 && i !== 0 ? props.lastRowWidth : props.rowWidth });
|
|
64
88
|
}
|
|
65
89
|
return arr;
|
|
66
90
|
});
|
|
@@ -47,9 +47,14 @@
|
|
|
47
47
|
import Storage from './storage.vue';
|
|
48
48
|
import Console from './console.vue';
|
|
49
49
|
import System from './system.vue';
|
|
50
|
-
const whiteUrls = [
|
|
50
|
+
const whiteUrls = [
|
|
51
|
+
'http://192.168.11.231:6174',
|
|
52
|
+
'http://192.168.10.11:6174',
|
|
53
|
+
'http://dev-oa.ge.cn:6174',
|
|
54
|
+
'http://test-oa.ge.cn:6174',
|
|
55
|
+
];
|
|
51
56
|
const show = ref(false);
|
|
52
|
-
const isShowDebugButton = ref(whiteUrls.includes(uni.getStorageSync('baseUrl')));
|
|
57
|
+
const isShowDebugButton = ref(whiteUrls.includes(uni.getStorageSync('baseUrl')) || !!uni.getStorageSync('isDebug'));
|
|
53
58
|
const list = ref(['console', 'network', 'event', 'error', 'storage', 'system']);
|
|
54
59
|
const current = ref(0);
|
|
55
60
|
const openDebug = () => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 防抖函数
|
|
3
|
+
* @param callback
|
|
4
|
+
* @param time
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
declare function createDebounceFn(callback: (...params: any[]) => void, time: number): (...params: any[]) => void;
|
|
8
|
+
declare function getAsk(): string;
|
|
9
|
+
|
|
1
10
|
declare const _default: {
|
|
2
11
|
install: (Vue: any) => void;
|
|
3
12
|
};
|
|
4
13
|
|
|
5
|
-
export { _default as default };
|
|
14
|
+
export { createDebounceFn, _default as default, getAsk };
|
package/dist/index.umd.mini.js
CHANGED
|
@@ -4,12 +4,36 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["UNI-OAVIEW"] = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* 防抖函数
|
|
9
|
+
* @param callback
|
|
10
|
+
* @param time
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
function createDebounceFn(callback, time) {
|
|
14
|
+
var timer = null;
|
|
15
|
+
return function () {
|
|
16
|
+
for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17
|
+
params[_key] = arguments[_key];
|
|
18
|
+
}
|
|
19
|
+
clearTimeout(timer);
|
|
20
|
+
timer = setTimeout(function () {
|
|
21
|
+
callback.apply(void 0, params);
|
|
22
|
+
}, time);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function getAsk() {
|
|
26
|
+
return '我是一个until函数';
|
|
27
|
+
}
|
|
28
|
+
|
|
7
29
|
var install = function install(Vue) {};
|
|
8
30
|
var index = {
|
|
9
31
|
install: install
|
|
10
32
|
};
|
|
11
33
|
|
|
34
|
+
exports.createDebounceFn = createDebounceFn;
|
|
12
35
|
exports["default"] = index;
|
|
36
|
+
exports.getAsk = getAsk;
|
|
13
37
|
|
|
14
38
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
15
39
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uni-oaview",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "uniapp小程序组件库",
|
|
5
5
|
"main": "dist/index.umd.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -34,9 +34,10 @@
|
|
|
34
34
|
"rollup-plugin-eslint": "^7.0.0",
|
|
35
35
|
"rollup-plugin-terser": "^7.0.2",
|
|
36
36
|
"rollup-plugin-typescript2": "^0.27.2",
|
|
37
|
+
"rollup-plugin-vue": "^6.0.0",
|
|
37
38
|
"typescript": "^4.0.2"
|
|
38
39
|
},
|
|
39
|
-
"
|
|
40
|
+
"peerDependencies": {
|
|
40
41
|
"uniapp-log-sdk": "^1.1.1"
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
$bg-color: white;
|
|
2
|
-
$row-height: 32rpx;
|
|
3
|
-
$row-margin-top: 32rpx;
|
|
4
|
-
|
|
5
|
-
.skeleton {
|
|
6
|
-
display: flex;
|
|
7
|
-
padding: 32rpx;
|
|
8
|
-
}
|
|
9
|
-
.skeleton-avatar {
|
|
10
|
-
flex-shrink: 0;
|
|
11
|
-
background: $bg-color;
|
|
12
|
-
margin-right: 16rpx;
|
|
13
|
-
}
|
|
14
|
-
.skeleton-avatar.round {
|
|
15
|
-
border-radius: 50%;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.skeleton-content {
|
|
19
|
-
width: 100%;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.skeleton-title {
|
|
23
|
-
background-color: $bg-color;
|
|
24
|
-
height: $row-height;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.skeleton-title + .skeleton-rows {
|
|
28
|
-
margin-top: $row-margin-top;
|
|
29
|
-
}
|
|
30
|
-
.skeleton-row-item {
|
|
31
|
-
background-color: $bg-color;
|
|
32
|
-
height: $row-height;
|
|
33
|
-
}
|
|
34
|
-
.skeleton-row-item:not(:first-child) {
|
|
35
|
-
margin-top: $row-margin-top;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.skeleton.animate {
|
|
39
|
-
animation: skeleton-blink 1.2s ease-in-out infinite;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@keyframes skeleton-blink {
|
|
43
|
-
0% {
|
|
44
|
-
opacity: 1;
|
|
45
|
-
}
|
|
46
|
-
50% {
|
|
47
|
-
opacity: 0.6;
|
|
48
|
-
}
|
|
49
|
-
100% {
|
|
50
|
-
opacity: 1;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view>
|
|
3
|
-
<!-- 为了解决H5中v-if导致样式失效的问题,故使用v-show -->
|
|
4
|
-
<view v-show="loading">
|
|
5
|
-
<view class="skeleton" :class="{ animate: animate }">
|
|
6
|
-
<view
|
|
7
|
-
v-if="displayAvatar"
|
|
8
|
-
class="skeleton-avatar"
|
|
9
|
-
:class="[displayAvatarShape]"
|
|
10
|
-
:style="{ width: displayAvatarSize, height: displayAvatarSize }"
|
|
11
|
-
></view>
|
|
12
|
-
<view class="skeleton-content">
|
|
13
|
-
<view v-if="showTitle" class="skeleton-title" :style="{ width: titleWidth, height: rowHeight }"></view>
|
|
14
|
-
<view class="skeleton-rows">
|
|
15
|
-
<view
|
|
16
|
-
v-for="(item, index) in rowList"
|
|
17
|
-
:key="index"
|
|
18
|
-
class="skeleton-row-item"
|
|
19
|
-
:style="{ width: item.width, height: rowHeight }"
|
|
20
|
-
></view>
|
|
21
|
-
</view>
|
|
22
|
-
</view>
|
|
23
|
-
</view>
|
|
24
|
-
</view>
|
|
25
|
-
<view v-show="!loading"><slot></slot></view>
|
|
26
|
-
</view>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script lang="ts">
|
|
30
|
-
import { computed } from '@mk/composition-api';
|
|
31
|
-
import Vue from 'vue';
|
|
32
|
-
|
|
33
|
-
const DEFAULT_ROW_WIDTH = '100%';
|
|
34
|
-
const DEFAULT_LAST_ROW_WIDTH = '60%';
|
|
35
|
-
|
|
36
|
-
export default Vue.extend({
|
|
37
|
-
props: {
|
|
38
|
-
loading: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
/** 是否展示图片 */
|
|
43
|
-
showAvatar: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: false,
|
|
46
|
-
},
|
|
47
|
-
/** 展示图片的尺寸 */
|
|
48
|
-
avatarSize: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: '',
|
|
51
|
-
},
|
|
52
|
-
/** 图片的形状 */
|
|
53
|
-
avatarShape: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: '', // square | round
|
|
56
|
-
},
|
|
57
|
-
/** 是否展示标题条 */
|
|
58
|
-
showTitle: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false,
|
|
61
|
-
},
|
|
62
|
-
/** 标题条的宽度 */
|
|
63
|
-
titleWidth: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: '40%',
|
|
66
|
-
},
|
|
67
|
-
/** 需要展示几行 */
|
|
68
|
-
row: {
|
|
69
|
-
type: Number,
|
|
70
|
-
default: 3,
|
|
71
|
-
},
|
|
72
|
-
/** 行高 */
|
|
73
|
-
rowHeight: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: '32rpx',
|
|
76
|
-
},
|
|
77
|
-
/** 是否展示动画 */
|
|
78
|
-
animate: {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
default: true,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
setup(props: any) {
|
|
84
|
-
const rowList = computed(() => {
|
|
85
|
-
const arr: Array<any> = [];
|
|
86
|
-
for (let i = 0; i < props.row; i++) {
|
|
87
|
-
arr.push({ width: i === props.row - 1 && i !== 0 ? DEFAULT_LAST_ROW_WIDTH : DEFAULT_ROW_WIDTH });
|
|
88
|
-
}
|
|
89
|
-
return arr;
|
|
90
|
-
});
|
|
91
|
-
const displayAvatar = computed(() => props.avatarShape || props.showAvatar || props.avatarSize);
|
|
92
|
-
const displayAvatarShape = computed(() => props.avatarShape || 'round');
|
|
93
|
-
const displayAvatarSize = computed(() => props.avatarSize || '100rpx');
|
|
94
|
-
return {
|
|
95
|
-
rowList,
|
|
96
|
-
displayAvatar,
|
|
97
|
-
displayAvatarShape,
|
|
98
|
-
displayAvatarSize,
|
|
99
|
-
};
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
</script>
|
|
103
|
-
|
|
104
|
-
<style lang="scss" scoped src="./skeleton.scss"></style>
|