yh-mobile-components 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/form/yhmPassword.vue +106 -0
- package/index.ts +2 -0
- package/info/yhmList.vue +2 -2
- package/package.json +1 -1
- package/types.ts +13 -5
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-field
|
|
3
|
+
class="yhm-input-container"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
:model-value="modelValue"
|
|
6
|
+
@update:modelValue="changeHandler"
|
|
7
|
+
:type="inputType"
|
|
8
|
+
:error="error"
|
|
9
|
+
:error-message="errorMessage">
|
|
10
|
+
<template #right-icon>
|
|
11
|
+
<svg
|
|
12
|
+
width="40px"
|
|
13
|
+
height="20px"
|
|
14
|
+
style="vertical-align: middle"
|
|
15
|
+
viewBox="0 0 2000 1000"
|
|
16
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
17
|
+
@click="showPassword = !showPassword">
|
|
18
|
+
<path
|
|
19
|
+
d="M100,100 L1900,100 L1900,900 L100,900 Z"
|
|
20
|
+
stroke="var(--van-field-right-icon-color)"
|
|
21
|
+
stroke-width="60"
|
|
22
|
+
stroke-linejoin="round"
|
|
23
|
+
fill="none"></path>
|
|
24
|
+
<g v-if="!showPassword">
|
|
25
|
+
<circle
|
|
26
|
+
r="150"
|
|
27
|
+
stroke-width="0"
|
|
28
|
+
fill="var(--van-field-right-icon-color)"
|
|
29
|
+
cx="500"
|
|
30
|
+
cy="500"></circle>
|
|
31
|
+
<circle
|
|
32
|
+
r="150"
|
|
33
|
+
stroke-width="0"
|
|
34
|
+
fill="var(--van-field-right-icon-color)"
|
|
35
|
+
cx="1000"
|
|
36
|
+
cy="500"></circle>
|
|
37
|
+
<circle
|
|
38
|
+
r="150"
|
|
39
|
+
stroke-width="0"
|
|
40
|
+
fill="var(--van-field-right-icon-color)"
|
|
41
|
+
cx="1500"
|
|
42
|
+
cy="500"></circle>
|
|
43
|
+
</g>
|
|
44
|
+
<g v-else>
|
|
45
|
+
<polyline
|
|
46
|
+
points="350,300 650,300 500,300 500 700"
|
|
47
|
+
stroke="var(--van-field-right-icon-color)"
|
|
48
|
+
stroke-width="60"
|
|
49
|
+
stroke-linejoin="round"
|
|
50
|
+
fill="none"></polyline>
|
|
51
|
+
<polyline
|
|
52
|
+
points="850,300 1150,300 1000,300 1000 700"
|
|
53
|
+
stroke="var(--van-field-right-icon-color)"
|
|
54
|
+
stroke-width="60"
|
|
55
|
+
stroke-linejoin="round"
|
|
56
|
+
fill="none"></polyline>
|
|
57
|
+
<polyline
|
|
58
|
+
points="1350,300 1650,300 1500,300 1500 700"
|
|
59
|
+
stroke="var(--van-field-right-icon-color)"
|
|
60
|
+
stroke-width="60"
|
|
61
|
+
stroke-linejoin="round"
|
|
62
|
+
fill="none"></polyline>
|
|
63
|
+
</g>
|
|
64
|
+
</svg>
|
|
65
|
+
</template>
|
|
66
|
+
</van-field>
|
|
67
|
+
</template>
|
|
68
|
+
<script setup lang="ts">
|
|
69
|
+
import { computed, ref } from "vue";
|
|
70
|
+
const props = withDefaults(
|
|
71
|
+
defineProps<{
|
|
72
|
+
error?: boolean;
|
|
73
|
+
errorMessage?: string;
|
|
74
|
+
modelValue?: any;
|
|
75
|
+
scanCallback?: (val) => void;
|
|
76
|
+
}>(),
|
|
77
|
+
{}
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const showPassword = ref(false);
|
|
81
|
+
|
|
82
|
+
const inputType = computed(() => {
|
|
83
|
+
if (showPassword.value) {
|
|
84
|
+
return "text";
|
|
85
|
+
} else {
|
|
86
|
+
return "password";
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const emits = defineEmits<{
|
|
91
|
+
(e: "update:modelValue", val: any);
|
|
92
|
+
(e: "change", val: any);
|
|
93
|
+
}>();
|
|
94
|
+
|
|
95
|
+
function changeHandler(val) {
|
|
96
|
+
emits("update:modelValue", val);
|
|
97
|
+
emits("change", val);
|
|
98
|
+
}
|
|
99
|
+
</script>
|
|
100
|
+
<style lang="scss">
|
|
101
|
+
.yhm-input-container {
|
|
102
|
+
.van-field__control {
|
|
103
|
+
text-align: right;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|
package/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import yhmCheckbox from "./form/yhmCheckbox.vue";
|
|
|
10
10
|
import yhmSelect from "./form/yhmSelect.vue";
|
|
11
11
|
import yhmInput from "./form/yhmInput.vue";
|
|
12
12
|
import yhmSwitch from "./form/yhmSwitch.vue";
|
|
13
|
+
import yhmPassword from "./form/yhmPassword.vue";
|
|
13
14
|
import vant from "vant";
|
|
14
15
|
import "vant/lib/index.css";
|
|
15
16
|
import "yh-mobile-components/custom.scss";
|
|
@@ -28,6 +29,7 @@ export default {
|
|
|
28
29
|
app.component("yhm-input", yhmInput);
|
|
29
30
|
app.component("yhm-select", yhmSelect);
|
|
30
31
|
app.component("yhm-switch", yhmSwitch);
|
|
32
|
+
app.component("yhm-password", yhmPassword);
|
|
31
33
|
app.use(vant);
|
|
32
34
|
},
|
|
33
35
|
};
|
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, params, keyword))"
|
|
44
44
|
:label="item.label"
|
|
45
45
|
:span="item.span"
|
|
46
|
-
:status="item.status && item.status(row)"
|
|
46
|
+
:status="item.status && item.status(row, params, keyword)"
|
|
47
47
|
:description="row[item.description] || item.description"
|
|
48
48
|
:value="row[item.value] || item.value">
|
|
49
49
|
<slot
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -31,10 +31,18 @@ export interface ListItem<T> {
|
|
|
31
31
|
description: keyof T;
|
|
32
32
|
/** 自定义插槽,用来渲染自定义元素 */
|
|
33
33
|
slot?: string;
|
|
34
|
-
/** 值的样式,自定义不同的颜色
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/** 值的样式,自定义不同的颜色
|
|
35
|
+
* @param row 当前行数据
|
|
36
|
+
* @param params 列表筛选数据
|
|
37
|
+
* @param keyword 列表筛选关键字
|
|
38
|
+
*/
|
|
39
|
+
status?: (row: T, parmas: any, keyword: string) => StatusType;
|
|
40
|
+
/** 是否显示
|
|
41
|
+
* @param row 当前行数据
|
|
42
|
+
* @param params 列表筛选数据
|
|
43
|
+
* @param keyword 列表筛选关键字
|
|
44
|
+
*/
|
|
45
|
+
show?: (row: T, parmas: any, keyword: string) => boolean;
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
/** 列表配置 */
|
|
@@ -63,7 +71,7 @@ export interface vanOption {
|
|
|
63
71
|
}
|
|
64
72
|
|
|
65
73
|
export type DateTimeType = "year" | "month" | "datetime" | "date" | "time";
|
|
66
|
-
export type InputType = "color" | "email" | "number" | "tel" | "text" | "textarea" | "url" | "digit";
|
|
74
|
+
export type InputType = "color" | "email" | "number" | "tel" | "text" | "textarea" | "url" | "digit" | "scan";
|
|
67
75
|
export type OtherType = "checkbox" | "radio" | "select" | "switch" | "password" | "rate" | "signature" | "cascader" | "slider" | "stepper";
|
|
68
76
|
|
|
69
77
|
export type FromItemType = OtherType | InputType | DateTimeType;
|