yh-mobile-components 1.0.4 → 1.0.6
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/form/yhmCascader.vue +5 -0
- package/form/yhmPassword.vue +16 -6
- package/form/yhmRate.vue +5 -0
- package/form/yhmSignature.vue +5 -0
- package/form/yhmSlider.vue +5 -0
- package/form/yhmStepper.vue +5 -0
- package/index.ts +12 -0
- package/info/yhmList.vue +7 -4
- package/info/yhmTable.vue +21 -0
- package/package.json +1 -1
- package/types.ts +10 -7
package/form/yhmPassword.vue
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<van-field
|
|
3
|
-
class="yhm-
|
|
3
|
+
class="yhm-password-container"
|
|
4
|
+
ref="passwordRef"
|
|
4
5
|
v-bind="$attrs"
|
|
5
6
|
:model-value="modelValue"
|
|
6
7
|
@update:modelValue="changeHandler"
|
|
@@ -14,13 +15,13 @@
|
|
|
14
15
|
style="vertical-align: middle"
|
|
15
16
|
viewBox="0 0 2000 1000"
|
|
16
17
|
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
-
@click="
|
|
18
|
+
@click="changeShowPassword">
|
|
18
19
|
<path
|
|
19
|
-
d="M100,100
|
|
20
|
+
d="M100,500 L100,200 S100,100 200,100 L1800,100 S1900,100 1900,200 L1900,800 S1900,900 1800,900 L200,900 S100,900 100,800 Z"
|
|
20
21
|
stroke="var(--van-field-right-icon-color)"
|
|
21
|
-
stroke-width="
|
|
22
|
-
stroke-linejoin="round"
|
|
22
|
+
stroke-width="50"
|
|
23
23
|
fill="none"></path>
|
|
24
|
+
pa
|
|
24
25
|
<g v-if="!showPassword">
|
|
25
26
|
<circle
|
|
26
27
|
r="150"
|
|
@@ -46,18 +47,21 @@
|
|
|
46
47
|
points="350,300 650,300 500,300 500 700"
|
|
47
48
|
stroke="var(--van-field-right-icon-color)"
|
|
48
49
|
stroke-width="60"
|
|
50
|
+
stroke-linecap="round"
|
|
49
51
|
stroke-linejoin="round"
|
|
50
52
|
fill="none"></polyline>
|
|
51
53
|
<polyline
|
|
52
54
|
points="850,300 1150,300 1000,300 1000 700"
|
|
53
55
|
stroke="var(--van-field-right-icon-color)"
|
|
54
56
|
stroke-width="60"
|
|
57
|
+
stroke-linecap="round"
|
|
55
58
|
stroke-linejoin="round"
|
|
56
59
|
fill="none"></polyline>
|
|
57
60
|
<polyline
|
|
58
61
|
points="1350,300 1650,300 1500,300 1500 700"
|
|
59
62
|
stroke="var(--van-field-right-icon-color)"
|
|
60
63
|
stroke-width="60"
|
|
64
|
+
stroke-linecap="round"
|
|
61
65
|
stroke-linejoin="round"
|
|
62
66
|
fill="none"></polyline>
|
|
63
67
|
</g>
|
|
@@ -96,9 +100,15 @@ function changeHandler(val) {
|
|
|
96
100
|
emits("update:modelValue", val);
|
|
97
101
|
emits("change", val);
|
|
98
102
|
}
|
|
103
|
+
|
|
104
|
+
const passwordRef = ref();
|
|
105
|
+
function changeShowPassword() {
|
|
106
|
+
showPassword.value = !showPassword.value;
|
|
107
|
+
passwordRef.value?.focus();
|
|
108
|
+
}
|
|
99
109
|
</script>
|
|
100
110
|
<style lang="scss">
|
|
101
|
-
.yhm-
|
|
111
|
+
.yhm-password-container {
|
|
102
112
|
.van-field__control {
|
|
103
113
|
text-align: right;
|
|
104
114
|
}
|
package/form/yhmRate.vue
ADDED
package/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import yhmDropdownItem from "./info/yhmDropdownItem.vue";
|
|
|
3
3
|
import yhmTabs from "./info/yhmTabs.vue";
|
|
4
4
|
import yhmInfo from "./info/yhmInfo.vue";
|
|
5
5
|
import yhmInfoItem from "./info/yhmInfoItem.vue";
|
|
6
|
+
import yhmTable from "./info/yhmTable.vue";
|
|
6
7
|
import yhmForm from "./form/yhm-form.vue";
|
|
7
8
|
import yhmDatetime from "./form/yhmDatetime.vue";
|
|
8
9
|
import yhmRadio from "./form/yhmRadio.vue";
|
|
@@ -11,6 +12,11 @@ import yhmSelect from "./form/yhmSelect.vue";
|
|
|
11
12
|
import yhmInput from "./form/yhmInput.vue";
|
|
12
13
|
import yhmSwitch from "./form/yhmSwitch.vue";
|
|
13
14
|
import yhmPassword from "./form/yhmPassword.vue";
|
|
15
|
+
import yhmCascader from "./form/yhmCascader.vue";
|
|
16
|
+
import yhmRate from "./form/yhmRate.vue";
|
|
17
|
+
import yhmSignature from "./form/yhmSignature.vue";
|
|
18
|
+
import yhmSlider from "./form/yhmSlider.vue";
|
|
19
|
+
import yhmStepper from "./form/yhmStepper.vue";
|
|
14
20
|
import vant from "vant";
|
|
15
21
|
import "vant/lib/index.css";
|
|
16
22
|
import "yh-mobile-components/custom.scss";
|
|
@@ -22,6 +28,7 @@ export default {
|
|
|
22
28
|
app.component("yhm-tabs", yhmTabs);
|
|
23
29
|
app.component("yhm-info", yhmInfo);
|
|
24
30
|
app.component("yhm-info-item", yhmInfoItem);
|
|
31
|
+
app.component("yhm-table", yhmTable);
|
|
25
32
|
app.component("yhm-form", yhmForm);
|
|
26
33
|
app.component("yhm-datetime", yhmDatetime);
|
|
27
34
|
app.component("yhm-radio", yhmRadio);
|
|
@@ -30,6 +37,11 @@ export default {
|
|
|
30
37
|
app.component("yhm-select", yhmSelect);
|
|
31
38
|
app.component("yhm-switch", yhmSwitch);
|
|
32
39
|
app.component("yhm-password", yhmPassword);
|
|
40
|
+
app.component("yhm-cascader", yhmCascader);
|
|
41
|
+
app.component("yhm-rate", yhmRate);
|
|
42
|
+
app.component("yhm-signature", yhmSignature);
|
|
43
|
+
app.component("yhm-slider", yhmSlider);
|
|
44
|
+
app.component("yhm-stepper", yhmStepper);
|
|
33
45
|
app.use(vant);
|
|
34
46
|
},
|
|
35
47
|
};
|
package/info/yhmList.vue
CHANGED
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
<yhm-info has-top>
|
|
41
41
|
<template v-for="item in listConfig?.items">
|
|
42
42
|
<yhm-info-item
|
|
43
|
-
v-if="!item.show || (item.show && item.show(row
|
|
43
|
+
v-if="!item.show || (item.show && item.show(row))"
|
|
44
44
|
:label="item.label"
|
|
45
45
|
:span="item.span"
|
|
46
|
-
:status="item.status && item.status(row
|
|
46
|
+
:status="item.status && item.status(row)"
|
|
47
47
|
:description="row[item.description] || item.description"
|
|
48
48
|
:value="row[item.value] || item.value">
|
|
49
49
|
<slot
|
|
@@ -119,13 +119,12 @@ async function getList(isClear = false) {
|
|
|
119
119
|
}
|
|
120
120
|
listError.value = false;
|
|
121
121
|
timer = setTimeout(async () => {
|
|
122
|
+
listLoading.value = true;
|
|
122
123
|
if (isClear) {
|
|
123
124
|
list.value = [];
|
|
124
125
|
finished.value = false;
|
|
125
126
|
refreshing.value = true;
|
|
126
127
|
pageIndex.value = 1;
|
|
127
|
-
} else {
|
|
128
|
-
listLoading.value = true;
|
|
129
128
|
}
|
|
130
129
|
let { data: l, total: t } = await props.getData(pageIndex.value, pageSize.value, params, keyword);
|
|
131
130
|
try {
|
|
@@ -164,6 +163,10 @@ onMounted(() => {
|
|
|
164
163
|
});
|
|
165
164
|
|
|
166
165
|
onActivated(() => {});
|
|
166
|
+
|
|
167
|
+
defineExpose({
|
|
168
|
+
getList,
|
|
169
|
+
});
|
|
167
170
|
</script>
|
|
168
171
|
<style lang="scss">
|
|
169
172
|
.yhm-list-container {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="yhm-table-container">
|
|
3
|
+
<table>
|
|
4
|
+
<colgroup>
|
|
5
|
+
<col />
|
|
6
|
+
</colgroup>
|
|
7
|
+
<tr></tr>
|
|
8
|
+
</table>
|
|
9
|
+
</section>
|
|
10
|
+
<talbe class="yhm-talbe-"></talbe>
|
|
11
|
+
</template>
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
const props = withDefaults(
|
|
14
|
+
defineProps<{
|
|
15
|
+
data: any[];
|
|
16
|
+
columns: ColumnItem[];
|
|
17
|
+
}>(),
|
|
18
|
+
{}
|
|
19
|
+
);
|
|
20
|
+
</script>
|
|
21
|
+
<style lang="scss"></style>
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -33,16 +33,12 @@ export interface ListItem<T> {
|
|
|
33
33
|
slot?: string;
|
|
34
34
|
/** 值的样式,自定义不同的颜色
|
|
35
35
|
* @param row 当前行数据
|
|
36
|
-
* @param params 列表筛选数据
|
|
37
|
-
* @param keyword 列表筛选关键字
|
|
38
36
|
*/
|
|
39
|
-
status?: (row: T
|
|
37
|
+
status?: (row: T) => StatusType;
|
|
40
38
|
/** 是否显示
|
|
41
39
|
* @param row 当前行数据
|
|
42
|
-
* @param params 列表筛选数据
|
|
43
|
-
* @param keyword 列表筛选关键字
|
|
44
40
|
*/
|
|
45
|
-
show?: (row: T
|
|
41
|
+
show?: (row: T) => boolean;
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
/** 列表配置 */
|
|
@@ -56,7 +52,7 @@ export interface ListConfig<T> {
|
|
|
56
52
|
export interface ListConfigObject<T> {
|
|
57
53
|
hasSearch: boolean;
|
|
58
54
|
searchPlaceholder: string;
|
|
59
|
-
paramType
|
|
55
|
+
paramType?: "dropdown" | "tabs";
|
|
60
56
|
paramConfig: ParamConfig[];
|
|
61
57
|
listConfig: ListConfig<T>;
|
|
62
58
|
getData: (pageIndex, pageSie, params, keyword) => Promise<{ data: any[]; total: number }>;
|
|
@@ -126,3 +122,10 @@ export interface ConfigFormItem {
|
|
|
126
122
|
/** 不同类型表单项的个性化配置 */
|
|
127
123
|
config: ConfigFormItem["type"] extends DateTimeType ? DatetimeConfig : ConfigFormItem["type"] extends "checkbox" ? CheckboxConfig : ConfigFormItem["type"] extends "radio" ? RadioConfig : ConfigFormItem["type"] extends "select" ? SelectConfig : ConfigFormItem["type"] extends "switch" ? SwitchConfig : {};
|
|
128
124
|
}
|
|
125
|
+
|
|
126
|
+
/** 表格单元格 */
|
|
127
|
+
export interface ColumnItem {
|
|
128
|
+
/** 表头名 */
|
|
129
|
+
label: string;
|
|
130
|
+
prop: string;
|
|
131
|
+
}
|