@fecp/mobile 1.0.14 → 1.0.16
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/es/packages/mobile/src/components/form/field/Field.vue.mjs +5 -3
- package/es/packages/mobile/src/components/form/form/Form.vue.mjs +2 -2
- package/es/packages/mobile/src/utils/formRule.mjs +2 -0
- package/lib/packages/mobile/src/components/form/field/Field.vue.js +4 -2
- package/lib/packages/mobile/src/components/form/form/Form.vue.js +1 -1
- package/lib/packages/mobile/src/utils/formRule.js +2 -0
- package/package.json +1 -1
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { useAttrs, createBlock, openBlock, mergeProps,
|
|
6
|
+
import { useAttrs, computed, createBlock, openBlock, mergeProps, createSlots, renderList, withCtx, renderSlot } from "vue";
|
|
7
7
|
import { parseRule } from "../../../utils/formRule.mjs";
|
|
8
8
|
import { Field } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/field/index.mjs";
|
|
9
9
|
const _sfc_main = {
|
|
10
10
|
__name: "Field",
|
|
11
11
|
setup(__props) {
|
|
12
12
|
const attrs = useAttrs();
|
|
13
|
-
const rules =
|
|
13
|
+
const rules = computed(() => {
|
|
14
|
+
return parseRule(attrs);
|
|
15
|
+
});
|
|
14
16
|
return (_ctx, _cache) => {
|
|
15
17
|
const _component_van_field = Field;
|
|
16
|
-
return openBlock(), createBlock(_component_van_field, mergeProps(_ctx.$attrs, { rules:
|
|
18
|
+
return openBlock(), createBlock(_component_van_field, mergeProps(_ctx.$attrs, { rules: rules.value }), createSlots({ _: 2 }, [
|
|
17
19
|
renderList(_ctx.$slots, (item, key) => {
|
|
18
20
|
return {
|
|
19
21
|
name: key,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
/* empty css */
|
|
3
|
-
import { createBlock, openBlock,
|
|
3
|
+
import { createBlock, openBlock, mergeProps, withCtx, createVNode, renderSlot } from "vue";
|
|
4
4
|
import { Form } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/form/index.mjs";
|
|
5
5
|
import { CellGroup } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/cell-group/index.mjs";
|
|
6
6
|
const _sfc_main = {
|
|
@@ -16,7 +16,7 @@ const _sfc_main = {
|
|
|
16
16
|
return (_ctx, _cache) => {
|
|
17
17
|
const _component_van_cell_group = CellGroup;
|
|
18
18
|
const _component_van_form = Form;
|
|
19
|
-
return openBlock(), createBlock(_component_van_form,
|
|
19
|
+
return openBlock(), createBlock(_component_van_form, mergeProps(_ctx.$attrs, { required: "auto" }), {
|
|
20
20
|
default: withCtx(() => [
|
|
21
21
|
createVNode(_component_van_cell_group, { inset: __props.isCard }, {
|
|
22
22
|
default: withCtx(() => [
|
|
@@ -5,6 +5,8 @@ const parseRule = ({ label, isRequired, ruleType }) => {
|
|
|
5
5
|
}
|
|
6
6
|
switch (ruleType) {
|
|
7
7
|
case "email":
|
|
8
|
+
var pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
9
|
+
ruleList.push({ pattern, message: `请填写正确的${label}` });
|
|
8
10
|
break;
|
|
9
11
|
case "phone":
|
|
10
12
|
var pattern = /^((\+?86)|(\(\+86\)))?(1[3-9]\d{9})$/;
|
|
@@ -12,10 +12,12 @@ const _sfc_main = {
|
|
|
12
12
|
__name: "Field",
|
|
13
13
|
setup(__props) {
|
|
14
14
|
const attrs = vue.useAttrs();
|
|
15
|
-
const rules =
|
|
15
|
+
const rules = vue.computed(() => {
|
|
16
|
+
return formRule.parseRule(attrs);
|
|
17
|
+
});
|
|
16
18
|
return (_ctx, _cache) => {
|
|
17
19
|
const _component_van_field = index.Field;
|
|
18
|
-
return vue.openBlock(), vue.createBlock(_component_van_field, vue.mergeProps(_ctx.$attrs, { rules:
|
|
20
|
+
return vue.openBlock(), vue.createBlock(_component_van_field, vue.mergeProps(_ctx.$attrs, { rules: rules.value }), vue.createSlots({ _: 2 }, [
|
|
19
21
|
vue.renderList(_ctx.$slots, (item, key) => {
|
|
20
22
|
return {
|
|
21
23
|
name: key,
|
|
@@ -18,7 +18,7 @@ const _sfc_main = {
|
|
|
18
18
|
return (_ctx, _cache) => {
|
|
19
19
|
const _component_van_cell_group = index$1.CellGroup;
|
|
20
20
|
const _component_van_form = index.Form;
|
|
21
|
-
return vue.openBlock(), vue.createBlock(_component_van_form, vue.
|
|
21
|
+
return vue.openBlock(), vue.createBlock(_component_van_form, vue.mergeProps(_ctx.$attrs, { required: "auto" }), {
|
|
22
22
|
default: vue.withCtx(() => [
|
|
23
23
|
vue.createVNode(_component_van_cell_group, { inset: __props.isCard }, {
|
|
24
24
|
default: vue.withCtx(() => [
|
|
@@ -7,6 +7,8 @@ const parseRule = ({ label, isRequired, ruleType }) => {
|
|
|
7
7
|
}
|
|
8
8
|
switch (ruleType) {
|
|
9
9
|
case "email":
|
|
10
|
+
var pattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
11
|
+
ruleList.push({ pattern, message: `请填写正确的${label}` });
|
|
10
12
|
break;
|
|
11
13
|
case "phone":
|
|
12
14
|
var pattern = /^((\+?86)|(\(\+86\)))?(1[3-9]\d{9})$/;
|