Browse Source

增加按钮类型、手机号验证码组件

pull/1/head
zq 4 months ago
parent
commit
1c54dbcd2c
  1. 105
      package-lock.json
  2. 1
      package.json
  3. 1
      src/assets/phone-fill.svg
  4. 1
      src/assets/require.svg
  5. 177
      src/assets/vabForm.js
  6. 2
      src/components/GuipButton.vue
  7. 247
      src/components/GuipForm.vue
  8. 107
      src/components/GuipFormItem.vue
  9. 118
      src/components/GuipInput.vue
  10. 2
      src/components/GuipTextarea.vue
  11. 76
      src/components/PhoneCode.vue
  12. 102
      src/style/theme/common.scss
  13. 334
      src/views/elementGroups.vue

105
package-lock.json

@ -8,6 +8,7 @@
"name": "newkuaile-vue-project2",
"version": "0.1.0",
"dependencies": {
"axios": "^1.7.9",
"core-js": "^3.8.3",
"element-ui": "^2.15.14",
"vue": "^2.6.14",
@ -3793,6 +3794,12 @@
"babel-runtime": "6.x"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
"license": "MIT"
},
"node_modules/at-least-node": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/at-least-node/-/at-least-node-1.0.0.tgz",
@ -3841,6 +3848,17 @@
"postcss": "^8.1.0"
}
},
"node_modules/axios": {
"version": "1.7.9",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
"integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
@ -4217,7 +4235,6 @@
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
@ -4552,6 +4569,18 @@
"dev": true,
"license": "MIT"
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"license": "MIT",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/commander": {
"version": "8.3.0",
"resolved": "https://registry.npmmirror.com/commander/-/commander-8.3.0.tgz",
@ -5376,6 +5405,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/depd/-/depd-2.0.0.tgz",
@ -5568,7 +5606,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
@ -5729,7 +5766,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@ -5739,7 +5775,6 @@
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@ -5756,7 +5791,6 @@
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"dev": true,
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0"
@ -5765,6 +5799,21 @@
"node": ">= 0.4"
}
},
"node_modules/es-set-tostringtag": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"license": "MIT",
"dependencies": {
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2",
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escalade": {
"version": "3.2.0",
"resolved": "https://registry.npmmirror.com/escalade/-/escalade-3.2.0.tgz",
@ -6715,7 +6764,6 @@
"version": "1.15.9",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz",
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
"dev": true,
"funding": [
{
"type": "individual",
@ -6732,6 +6780,21 @@
}
}
},
"node_modules/form-data": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz",
"integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
"license": "MIT",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmmirror.com/forwarded/-/forwarded-0.2.0.tgz",
@ -6815,7 +6878,6 @@
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
@ -6852,7 +6914,6 @@
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
@ -6877,7 +6938,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"dev": true,
"license": "MIT",
"dependencies": {
"dunder-proto": "^1.0.1",
@ -6977,7 +7037,6 @@
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@ -7043,7 +7102,6 @@
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@ -7052,6 +7110,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-tostringtag": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"license": "MIT",
"dependencies": {
"has-symbols": "^1.0.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hash-sum": {
"version": "2.0.0",
"resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-2.0.0.tgz",
@ -7063,7 +7136,6 @@
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"function-bind": "^1.1.2"
@ -8245,7 +8317,6 @@
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.4"
@ -8359,7 +8430,6 @@
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 0.6"
@ -8369,7 +8439,6 @@
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dev": true,
"license": "MIT",
"dependencies": {
"mime-db": "1.52.0"
@ -10004,6 +10073,12 @@
"node": ">= 0.10"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
"license": "MIT"
},
"node_modules/pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/pseudomap/-/pseudomap-1.0.2.tgz",

1
package.json

@ -8,6 +8,7 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^1.7.9",
"core-js": "^3.8.3",
"element-ui": "^2.15.14",
"vue": "^2.6.14",

1
src/assets/phone-fill.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="16" height="16" viewBox="0 0 16 16"><defs><clipPath id="master_svg0_111_50174"><rect x="0" y="0" width="16" height="16" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_111_50174)"><g><path d="" fill="#A6A6A6" fill-opacity="0" style="mix-blend-mode:passthrough"/><path d="M14.65,10.94667Q14.65,10.05765,13.7655,9.96829Q13.5496,9.94649,13.4263,9.928799999999999Q12.1289,9.74344,10.94611,9.18161Q10.22206,8.837869999999999,9.7558,9.49014L9.04265,10.48861Q6.68556,9.31443,5.51141,6.95732L6.51237,6.2423Q7.16254,5.77791,6.81952,5.0563Q6.25729,3.87351,6.07148,2.5758609999999997Q6.05352,2.450462,6.03174,2.234607Q5.94247,1.35,5.0534,1.35L2.695907,1.35Q2.177544,1.35,1.798305,1.703385Q1.4190749999999999,2.0567609,1.3825159999999999,2.573859Q1.35,3.0341,1.35,3.33333Q1.349998,8.02087,4.66456,11.33544Q7.97913,14.65,12.6667,14.65Q12.9663,14.65,13.4262,14.6175Q13.9432,14.581,14.2966,14.2017Q14.65,13.8225,14.65,13.3041L14.65,10.94667ZM13.35,11.23006L13.35,13.3041Q13.35,13.3197,13.3345,13.3208Q12.9205,13.35,12.6667,13.35Q8.5176,13.35,5.5838,10.4162Q2.649999,7.4824,2.65,3.33333Q2.65,3.0799700000000003,2.679284,2.665475Q2.680378,2.65,2.695907,2.65L4.76995,2.65Q4.77743,2.710006,4.78461,2.7601649999999998Q4.97776,4.1091,5.52452,5.350350000000001L3.89234,6.51626L4.09815,6.99701Q5.56847,10.43153,9.00299,11.90188L9.48377,12.1077L10.64959,10.47545Q11.89205,11.0228,13.2425,11.21573Q13.2913,11.22274,13.35,11.23006Z" fill-rule="evenodd" fill="#000000" fill-opacity="1"/></g></g></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

1
src/assets/require.svg

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="8" height="8" viewBox="0 0 8 8"><g><g><path d="M4.53619,3.49598C4.93756,3.30242,5.33495,3.10073,5.72813,2.89102C6.10411,2.68903,6.40809,2.53804,6.63208,2.44504C6.85606,2.35305,7.03205,2.30305,7.16805,2.30305C7.39203,2.30305,7.58402,2.37805,7.75201,2.53804C7.912,2.69803,8,2.89102,8,3.126C8,3.26099,7.96,3.40299,7.88001,3.54598C7.80001,3.68897,7.71202,3.78196,7.62402,3.82396C6.80007,4.16794,5.88012,4.41992,4.88817,4.57091C5.07216,4.7389,5.28815,4.97489,5.55214,5.26887C5.81612,5.56285,5.95211,5.71384,5.96811,5.73884C6.06411,5.88183,6.2001,6.05882,6.37609,6.26881C6.55208,6.4788,6.67207,6.63879,6.73607,6.75578C6.80007,6.87377,6.84006,7.01576,6.84006,7.18475C6.84107,7.39587,6.75753,7.5986,6.60808,7.74772C6.45193,7.91074,6.23371,7.99948,6.00811,7.9917C5.76812,7.9917,5.48814,7.78972,5.18416,7.39474C4.88017,7.00776,4.4802,6.29481,4.00022,5.26087C3.51225,6.18481,3.18427,6.80678,3.02428,7.10076C2.85629,7.39474,2.69629,7.62073,2.5443,7.77272C2.40703,7.91778,2.21605,7.99989,2.01633,7.9997C1.79003,8.00605,1.5728,7.91065,1.42436,7.73972C1.28036,7.59025,1.19759,7.39224,1.19238,7.18475C1.19238,6.99976,1.22438,6.86477,1.28837,6.77278C1.88034,5.93283,2.49631,5.19288,3.13627,4.57991C2.65244,4.50186,2.17205,4.40378,1.69635,4.28593C1.23363,4.16226,0.781541,4.00176,0.344425,3.80596C0.264429,3.76496,0.192433,3.67197,0.120437,3.52898C0.0420906,3.41216,0.00031659,3.27466,0.000443602,3.134C-0.00716869,2.91112,0.0835016,2.69615,0.24843,2.54604C0.397403,2.39297,0.602823,2.30798,0.816398,2.31105C0.96839,2.31105,1.16038,2.36105,1.39237,2.45404C1.62435,2.55404,1.91234,2.68903,2.27232,2.88202C2.6323,3.06701,3.03228,3.27699,3.48825,3.50398C3.40825,3.07601,3.33626,2.58804,3.28026,2.04207C3.22427,1.4961,3.20027,1.11813,3.20027,0.916139C3.20027,0.664155,3.27226,0.454168,3.42425,0.277179C3.5641,0.0976285,3.7807,-0.00510704,4.00822,0.000195663C4.24021,0.000195663,4.4322,0.09219,4.58419,0.269179C4.73618,0.454168,4.80818,0.689153,4.80818,0.983135C4.80818,1.06713,4.79218,1.22712,4.77618,1.46311C4.76018,1.70609,4.72018,1.99207,4.68018,2.32805C4.63219,2.67203,4.58419,3.05801,4.53619,3.49598Z" fill="#FF4D4F" fill-opacity="1"/></g></g></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

177
src/assets/vabForm.js

@ -0,0 +1,177 @@
export const rules = () => {
return [
{
field: 'id',
type: 'select',
label: '部门',
multiple:false,
placeholder: '请选择部门',
colWidth: 'el-col-10',
options: [
{
label: '部门一',
value: 90000,
},
{
label: '部门二',
value: 50000,
}
],
rules: [
{
required: true,
message: '请选择部门',
trigger: 'change'
},
]
},
{
field: 'id1',
type: 'select',
label: '部门1',
multiple:false,
placeholder: '请选择部门1',
colWidth: 'el-col-10',
options: [
{
label: '部门一1',
value: 2345678,
},
{
label: '部门二2',
value: 6543450,
}
],
rules: [
{
required: true,
message: '请选择部门',
trigger: 'change'
},
]
},
{
field: 'name',
label: '用户名',
placeholder: '请输入活动名称',
type: 'input',
maxLenght: 20,
colWidth: 'el-col-24',
rules: [
{ required: true, message: '请输入活动名称', trigger: ['blur', 'change'] },
]
},
{
field: 'radioId',
type: 'radio',
label: '备选项',
colWidth: 'el-col-24',
options: [
{
label: '选项一',
value: '1',
},
{
label: '选项二',
value: '2',
}
],
rules: [
{
required: true,
message: '请选择备选项',
trigger: 'blur'
},
]
},
{
field: 'checkboxId',
type: 'checkbox',
label: '状态',
colWidth: 'el-col-24',
cities: ['上海', '北京', '广州', '深圳'],
rules: [
{
required: true,
message: '请选择状态',
trigger: 'change'
},
]
},
{
field: 'textareaIner',
label: '内容',
placeholder: '请输入内容',
maxLenght: 300,
type: 'textarea',
rowsHeight: 4,
colWidth: 'el-col-24',
rules: [
{ required: true, message: '请输入内容', trigger: ['blur', 'change'] }
]
},
{
field: 'dateTime',
label: '内容',
placeholder: '请输入内容',
type: 'date',
pickerOptions: pickerOptions(),
colWidth: 'el-col-24',
rules: [
{ required: true, message: '请输入内容', trigger: 'blur' }
]
},
{
field: 'uploadList',
label: '附件',
headers: {},
action: '/action',
type: 'upload',
multiple: true,
colWidth: 'el-col-24',
rules: [
{ required: true, message: '请上传附件', trigger: ['blur', 'change'] },
callback()
]
},
]
}
function callback() {
return {
validator: function (rule, value, callback) {
console.log(rule, value);
if (value) {
callback()
}
}
}
}
function pickerOptions() {
return {
disabledDate(time) {
return time.getTime() > Date.now();
},
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
}
}

2
src/components/GuipButton.vue

@ -5,6 +5,7 @@
:loading="loading"
:size="size"
:disabled="disabled"
@click="$emit('click')"
:style="{...btnstyle}"
>
<slot></slot>
@ -14,7 +15,6 @@
<script>
export default {
name: 'GuipButton',
// props:['type','plain'],
props:{
type:{
type:String,

247
src/components/GuipForm.vue

@ -0,0 +1,247 @@
<!-- Dom模板 -->
<template>
<div>
<!-- Dom内容 -->
<el-form
:model="ruleForm"
ref="ruleForm"
:label-width="labelWidth"
class="el-row demo-ruleForm"
:label-position="labelPosition"
>
<el-form-item
v-for="(item, index) in formList"
:key="index"
:label="item.label"
:prop="item.field"
:rules="detail ? false : item.rules"
:class="item.colWidth"
>
<!-- 输入框 -->
<template v-if="item.type === 'input'">
<el-input
:placeholder="item.placeholder"
clearable
:disabled="disabled"
v-model="ruleForm[`${item.field}`]"
/>
</template>
<!-- 下拉框 -->
<template v-if="item.type === 'select'">
<el-select
v-model="ruleForm[`${item.field}`]"
:placeholder="item.placeholder"
:disabled="disabled"
:multiple="item.multiple"
style="width: 100%"
@change="changeSelect"
>
<el-option
v-for="(element, i) in item.options"
:label="element.label"
:value="`${element.value}`"
:key="i"
/>
</el-select>
</template>
<!-- 单选框 -->
<template v-if="item.type === 'radio'">
<el-radio-group
v-model="ruleForm[`${item.field}`]"
:disabled="disabled"
>
<el-radio
v-for="(element, i) in item.options"
:key="i"
:label="`${element.value}`"
>
{{ element.label }}
</el-radio>
</el-radio-group>
</template>
<!-- 复选框 -->
<template v-if="item.type === 'checkbox'">
<el-checkbox-group
v-model="ruleForm[`${item.field}`]"
:disabled="disabled"
>
<el-checkbox
v-for="(city, i) in item.cities"
:label="city"
:name="city"
:key="i"
>
{{ city }}
</el-checkbox>
</el-checkbox-group>
</template>
<!--文本框 -->
<template v-if="item.type === 'textarea'">
<el-input
:maxlength="item.maxLenght"
type="textarea"
:rows="item.rowsHeight"
:disabled="disabled"
:placeholder="item.placeholder"
v-model="ruleForm[`${item.field}`]"
/>
</template>
<!-- 时间选择 -->
<template v-if="item.type === 'date'">
<el-date-picker
v-model="ruleForm[`${item.field}`]"
align="right"
style="width: 100%"
value-format="yyyy-MM-dd HH:mm:ss"
:disabled="disabled"
type="date"
placeholder="选择日期"
:picker-options="item.pickerOptions"
>
</el-date-picker>
</template>
<!-- 附件 -->
<template v-if="item.type === 'upload'">
<el-upload
:action="item.action"
list-type="picture-card"
:headers="item.headers"
:disabled="disabled"
class="upload-demo"
:multiple="item.multiple"
:data="ruleForm[`${item.field}`]"
:file-list="ruleForm[`${item.field}`]"
:on-change="uploadFile"
:auto-upload="false"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
>
<i slot="default" class="el-icon-plus"></i>
</el-upload>
</template>
</el-form-item>
</el-form>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="" />
</el-dialog>
</div>
</template>
<script>
export default {
props: {
detail: {
type: Boolean,
default: () => false,
},
disabled: {
type: Boolean,
default: () => false,
},
//
fromItem: {
type: Object,
default: () => null,
},
labelWidth: {
type: String,
default: () => "100px",
},
//
formNewList: {
type: Array,
default: () => [],
},
labelPosition: {
type: String,
default: () => "right",
},
},
watch: {
formNewList: {
immediate: true, //
handler() {
this.formList = this.formNewList;
this.defaultFun();
},
},
},
data() {
return {
ruleForm: {},
formList: [],
dialogImageUrl: "",
dialogVisible: false,
};
},
methods: {
//
changeSelect(row) {
// console.log(row);
this.$emit("changeSelect", row);
},
//
uploadFile(file, fileList) {
this.formList.forEach((item) => {
if (item.type === "upload") {
this.$set(this.ruleForm, item.field, fileList);
}
});
},
//
handleRemove(file) {
this.formList.forEach((item) => {
let fileList = this.ruleForm[`${item.field}`];
if (item.type === "upload") {
fileList.forEach((element, i) => {
if (file.uid === element.uid) {
fileList.splice(i, 1);
}
});
}
this.$set(this.ruleForm, item.field, fileList);
});
},
//
handlePictureCardPreview(file) {
console.log(file);
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
//
defaultFun() {
if (this.fromItem !== null) {
//
this.ruleForm = { ...this.ruleForm, ...this.fromItem };
} else {
//
this.formList.forEach((item) => {
if (item.cities) {
this.$set(this.ruleForm, item.field, []);
} else {
this.$set(this.ruleForm, item.field, "");
}
if (item.type === "radio") {
this.$set(this.ruleForm, item.field, "1");
}
if (item.type === "upload") {
this.$set(this.ruleForm, item.field, []);
}
});
}
console.log(this.ruleForm);
},
//from
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$emit("headdenForm", this.ruleForm);
}
});
},
//
resetForm(formName) {
this.$refs[formName].resetFields();
},
},
};
</script>

107
src/components/GuipFormItem.vue

@ -0,0 +1,107 @@
<template>
<div
:class="[{'column':column},{'error':hasError},{'w510':addClass=='w510'},{'w388':addClass=='w388'},'form-item']">
<div class="form-item-top">
<label v-if="label" for="">{{ label }}
<img src="../assets/require.svg" v-if="required" alt="">
</label>
<template >
<slot name="formLeft"></slot>
</template>
<template >
<slot name="formRight"></slot>
</template>
</div>
<div class="form-item-bottom">
<template >
<slot name="formDom"></slot>
</template>
</div>
</div>
</template>
<script>
export default {
name: 'GuipFormItem',
props:['label','required','addClass','column'],
data() {
return {
hasError: false,
//
classList:{
'w510':'w510',
'w388':'w388'
}
}
},
computed: {
// dynamicClasses() {
// return {
// active: this.isActive, // isActivetrue'active'
// error: this.hasError, // hasErrortrue'error'
// highlighted: this.isHighlighted, // isHighlightedtrue'highlighted'
// };
// }
},
mounted(){
console.log(this.required,'required----');
}
}
</script>
<style lang="scss" scoped>
.form-item{
display: flex;
align-items: center;
label{
min-width: 54px;
margin-right: 8px;
}
.form-item-top{
display: flex;
align-items: center;
text-align: left;
}
.form-item-bottom{
flex: 1;
}
.rightdesc{
flex: 1;
text-align: right;
font-size: 12px;
line-height: 13px;
letter-spacing: 0.08em;
font-variation-settings: "opsz" auto;
color: #8A9099;
}
}
.w510{
width: 510px;
}
.w388{
width: 388px;
}
.column{
display: flex;
flex-direction: column !important;
align-items: self-start;
.form-item-top{
width: 100%;
margin-bottom: 12px;
justify-content: space-between;
}
.form-item-bottom{
width: 100%;
}
}
.form-top-icon{
display: flex;
align-items: center;
img{
width: 16px;
height: 16px;
margin-right: 8px;
}
span{
color: #1E2226;
}
}
</style>

118
src/components/GuipInput.vue

@ -1,25 +1,121 @@
<template>
<el-input
type="text"
:style="{...styleObject}"
:rows="2"
placeholder="请输入内容"
:disabled="disabled"
v-model="textarea">
</el-input>
<el-input
:type="type"
:style="{...style,width:width,height:height,...styleObject}"
:placeholder="placeholder1"
:disabled="disabled"
:maxlength="maxlength1"
:minLength="minLength1"
:show-word-limit="showWordLimit"
@input="$emit('input', $event)"
@change="$emit('change', $event)"
@blur="$emit('blur', value)"
@focus="$emit('focus', value)"
v-model="value">
<!-- 自定义前面小图标 -->
<template v-slot:prepend>
<slot name="prependshow"></slot>
</template>
<template v-slot:prefix>
<slot name="prefix"></slot>
</template>
<!-- 清除小图标 -->
<template v-slot:suffix>
<slot name="suffix"></slot>
</template>
<template v-slot:append>
<slot name="appendshow"></slot>
</template>
<!-- <i slot="suffix" v-if="empty" class="el-icon-close" @click="handleClear">h</i> -->
<!-- <el-button slot="append" v-if="hasBtn" type="primary" @click="$emit('enter',value)">搜索</el-button> -->
</el-input>
</template>
<script>
export default {
name: 'GuipInput',
props:['styleObject','disabled'],
props:['styleObject','disabled','defaultValue','placeholder','maxlength','minLength','clear','width','height','showWordLimit','type'],
data() {
return {
textarea: ''
value: '',
maxlength1: '',
minLength1: 0,
style:{
width:'200px',
height:'38px'
},
placeholder1:'请输入内容'
}
},
watch: { // value prop 便 inputValue
defaultValue(newVal) {
console.log(newVal,'newVal');
this.value = newVal;
}
},
created(){
//
if(this.defaultValue != null){
this.value = this.defaultValue;
}
//
if(this.placeholder){
this.placeholder1 = this.placeholder;
}
//
if(this.maxlength){
this.maxlength1 = this.maxlength;
}
//
if(this.minLength){
this.minLength1 = this.minLength;
}
},
mounted(){
this.$nextTick(()=>{
let els = document.querySelectorAll('.el-input');
els.forEach(item=>{
item.onmouseover= function(){
item.classList.add("hoverclass")
}
item.onmouseout= function(){
item.classList.remove("hoverclass")
}
// item.addEventListener('mouseover',function(){
// console.log('');
// item.classList.add("hoverclass")
// })
// item.addEventListener('mouseoout',function(){
// console.log('');
// item.classList.remove("hoverclass")
// })
// item.addEventListener('mouseoenter',function(){
// console.log('---');
// item.classList.add("hoverclass")
// })
// item.addEventListener('mouseoleave',function(){
// console.log('');
// item.classList.remove("hoverclass")
// })
})
// console.log(el,'====9999');
// if(el&& this.styleObject){
// for(var key in this.styleObject){
// el.style[key] = this.styleObject[key]
// }
// }
})
},
methods:{
// input
// changeInput(event){
// this.$emit('input', event);
// }
// handleClear(){
// console.log('---');
// this.$emit('clear', '')
// }
}
}
</script>

2
src/components/GuipTextarea.vue

@ -1,7 +1,7 @@
<template>
<el-input
type="textarea"
:style="{width:styleObject.width,height:styleObject.height}"
:style="{...styleObject}"
:rows="2"
placeholder="请输入内容"
v-model="textarea">

76
src/components/PhoneCode.vue

@ -0,0 +1,76 @@
<template>
<div class="flex">
<GuipInput
ref="phoneNumber"
width="277px"
height="38px"
placeholder="请输入手机号码"/>
<GuipButton type="reverseMild" @click="sendCode" :btnstyle="{width:'99px',height:'38px'}" :disabled="isCounting">{{ countdownText }}</GuipButton>
</div>
</template>
<script>
// import axios from 'axios';
import GuipButton from '@/components/GuipButton.vue';
import GuipInput from '@/components/GuipInput.vue';
export default {
data() {
return {
phoneValue: '',
countdown: 60, //
isCounting: false, //
};
},
components: {
GuipButton,
GuipInput,
},
computed: {
countdownText() {
return this.isCounting ? `${this.countdown}秒后重试` : '获取验证码';
}
},
methods: {
async sendCode() {
if (!/^1\d{10}$/.test(this.$refs.phoneNumber.value)) {
alert('请输入有效的手机号码');
return;
}
this.phoneValue = this.$refs.phoneNumber.value;
this.startCountdown();
//
// try {
// const response = await axios.post('API', { phoneNumber: this.$refs.phoneNumber.value }); // API
// if (response.data.success) { //
// alert('');
// this.startCountdown();
// } else {
// throw new Error(response.data.message || ''); // 使
// }
// } catch (error) {
// console.error(':', error); //
// alert(''); //
// }
},
startCountdown() {
this.isCounting = true;
const interval = setInterval(() => {
this.countdown--;
if (this.countdown <= 0) {
clearInterval(interval);
this.isCounting = false;
this.countdown = 60; //
}
}, 1000);
}
}
};
</script>
<style lang="scss" scoped>
.flex{
display: flex;
justify-content: space-between;
}
</style>

102
src/style/theme/common.scss

@ -14,6 +14,7 @@ body{
display: flex;
align-items: center;
justify-content: center;
transition: all .3s;
}
.el-button--normal{
color: #626573;
@ -46,6 +47,26 @@ body{
height: 28px;
font-size: 12px;
}
.el-button--reverseMild{
background: #E8F0FE;
color: #006AFF;
border: none;
}
.el-button--reverseMild:hover{
border-color: #F2F7FF !important;
background-color:#F2F7FF !important;
}
.el-button--reverseMild.is-disabled, .el-button--reverseMild.is-disabled:hover{
color: #006AFF;
border-color: #E8F0FE;
background-color:#E8F0FE;
opacity: .7;
}
.el-button--mild.is-disabled, .el-button--mild.is-disabled:hover{
color: #006AFF;
opacity: .7;
border-color: #006AFF;
}
/* button==== end */
// radio ---start
@ -61,7 +82,86 @@ body{
font-weight: normal;
}
// radio ---end
// input ---start
.el-input{
border-radius: 2px;
border: 1px solid transparent;
}
.el-input:focus-within{
transition: all .5s;
outline: 3px solid #D8E9FA;
border-color: #006AFF !important;
}
.is-error .hoverclass{
border-color: transparent !important;
}
.is-error .el-input:focus-within{
outline: none !important;
border-color: transparent !important;
}
.el-input__inner{
height: 100%;
padding: 10px 12px;
border-radius: 2px;
}
.el-input__prefix{
display: flex;
align-items: center;
left: 12px;
cursor: pointer;
}
.el-input__suffix{
display: flex;
align-items: center;
right: 12px;
cursor: pointer;
}
.el-input__inner:focus{
border-color: transparent;
}
.el-input__inner:hover{
border-color: transparent;
}
.el-input--prefix .el-input__inner{
padding-left: 36px;
}
.el-input--suffix .el-input__inner{
padding-right: 36px;
}
.el-input.is-disabled .el-input__inner{
background: #F6F7FA !important;
border-color: #DFE2E6 !important;
color: #BABDC2 !important;
}
.hoverclass{
border-color: #006AFF !important;
transition: all .5s;
}
// input ---end
// select start
.el-select:hover .el-input__inner{
transition: all .5s;
border-color: transparent;
}
.el-select .el-input.is-focus .el-input__inner{
border-color: transparent;
transition: all .5s;
}
// select end
// input ---end
// textarea start
.el-textarea__inner{
padding: 10px 12px;
border-radius: 2px;
}
.el-textarea__inner:hover{
border-color: #006AFF;
}
.el-textarea__inner:focus{
transition: all .5s;
outline: 3px solid #D8E9FA;
}
// textarea end

334
src/views/elementGroups.vue

@ -1,5 +1,7 @@
<template>
<div class="elementWrap">
<!-- ele-item 为类名的这种div label h3 仅在此页面进行布局使用复制时无需复制此元素 -->
<div class="ele-item">
<label for="">下拉框</label>
<GuipSelect msg="Welcome to Your Vue.js App" :options="options"/>
@ -29,7 +31,50 @@
</div>
<div class="ele-item">
<label for="">文本域</label>
<GuipTextarea :styleObject="styleObject"/>
<GuipTextarea disabled :styleObject="styleObject"/>
</div>
<div class="ele-item">
<label for="">输入框</label>
<GuipInput
ref="GuipInput"
width="200px"
height="30px"
disabled
placeholder="这是自定义默认提示语"/>
<div style="width: 20px;height: 10px;"></div>
<GuipInput
ref="GuipInput"
:styleObject="styleObject1"
defaultValue="爱吃麻辣烫"
:maxlength="100"
@change="handleInput"
@blur="handleInput"
@input="handleInput"
@focus="handleInput"
placeholder="这是自定义默认提示语"/>
<div style="width: 20px;height: 10px;"></div>
<GuipInput
:defaultValue="defaultValue"
@clear="handleClear"
width="400px"
>
<span slot="prependshow">http:</span>
<img slot="prefix" src="../assets/radio_checked.svg" alt="">
<!-- 输入框后面小图标 -事件自定义 -->
<i slot="suffix" class="el-icon-close" @click="handleClear"></i>
<!-- <img slot="suffix" src="../assets/radio_nochecked.svg" alt="" @click="handleClear"> -->
<!-- 这个 appendshow 宽度 居中方式 自定义添加类名修改-->
<!-- <GuipButton slot="appendshow" size="mini">默认按钮</GuipButton> -->
<!-- 这个 appendshow 宽度 居中方式 自定义添加类名修改-->
<span slot="appendshow" >.checkcopy.com</span>
</GuipInput>
<!-- <el-input placeholder="oieuwroieuwi" style="width:400px;height:60px"></el-input> -->
</div>
<div class="ele-item">
<label for="">单选框</label>
@ -50,19 +95,24 @@
<GuipButton >默认按钮</GuipButton>
<GuipButton type="mild" size="medium">轻度按钮</GuipButton>
<GuipButton type="primary">按钮</GuipButton>
<GuipButton type="success" :loading="false" :plain="plain">按钮</GuipButton>
<GuipButton type="info" :loading="false" :plain="plain">按钮</GuipButton>
<GuipButton type="warning" :loading="false" :plain="plain">按钮</GuipButton>
<GuipButton type="danger" :loading="false" :plain="plain">按钮</GuipButton>
<GuipButton type="reverseMild">按钮</GuipButton>
<GuipButton type="primary" loading>按钮</GuipButton>
<GuipButton type="success" :plain="plain">按钮</GuipButton>
<GuipButton type="info" :plain="plain">按钮</GuipButton>
<GuipButton type="warning" :plain="plain">按钮</GuipButton>
<GuipButton type="danger" :plain="plain">按钮</GuipButton>
</div>
<div class="ele-item">
<label for="">禁用按钮</label>
<GuipButton :disabled="true">默认按钮</GuipButton>
<GuipButton type="primary" size="medium" :disabled="true">按钮</GuipButton>
<GuipButton type="success" :disabled="true">按钮</GuipButton>
<GuipButton type="info" :disabled="true">按钮</GuipButton>
<GuipButton type="warning" :disabled="true">按钮</GuipButton>
<GuipButton type="danger" :disabled="true">按钮</GuipButton>
<GuipButton disabled >默认按钮</GuipButton>
<GuipButton type="mild" disabled size="medium">轻度按钮</GuipButton>
<GuipButton type="reverseMild" disabled>按钮</GuipButton>
<GuipButton type="primary" size="medium" disabled>按钮</GuipButton>
<GuipButton type="success" disabled>按钮</GuipButton>
<GuipButton type="info" disabled>按钮</GuipButton>
<GuipButton type="warning" disabled>按钮</GuipButton>
<GuipButton type="danger" disabled>按钮</GuipButton>
</div>
<div class="ele-item">
<label for="">三种尺寸按钮</label>
@ -77,23 +127,116 @@
<GuipButton type="primary" :btnstyle="btnstyleObj1">随便写的</GuipButton>
</div>
<div class="ele-item">
<label for="">输入框</label>
<GuipInput :styleObject="styleObject1"/>
<!-- <el-input v-model="input" placeholder="请输入内容"></el-input> -->
</div>
<!-- <GuipRadio />
<GuipButton />
<GuipConfirm />
<GuipConfirm />
<GiupInput />
<GuipModal /> -->
<label for="">表单校验:</label>
<el-form :model="form" :rules="rules" ref="myForm">
<el-form-item label="用户名" prop="username">
<el-input v-model="form.username"></el-input>
</el-form-item>
<div style="display: flex;">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="triggerError">触发错误</el-button>
</div>
</el-form>
</div>
<div style="width: 300px;height: 100px;">
<h3>表单左右布局</h3>
<!-- 表单左右布局 -->
<GuipFormItem
label="标题"
:required="true"
>
<GuipInput
slot="formDom"
ref="GuipInput"
width="280px"
height="32px"
placeholder="这是自定义默认提示语"/>
</GuipFormItem>
</div>
<div style="width: 300px;height: 150px;">
<h3>表单上下布局</h3>
<GuipFormItem
label="标题"
:required="true"
column="column"
>
<GuipInput
slot="formDom"
ref="GuipInput"
width="100%"
height="38px"
placeholder="这是自定义默认提示语"/>
</GuipFormItem>
</div>
<div style="width: 300px;height: 150px;">
<h3>表单上下布局(带右侧文案)</h3>
<GuipFormItem
label="标题"
:required="true"
column="column"
addClass="w510"
>
<span class="rightdesc" slot="formRight">这是右侧文案</span>
<GuipInput
slot="formDom"
ref="GuipInput"
width="100%"
height="38px"
placeholder="这是自定义默认提示语"/>
</GuipFormItem>
</div>
<div style="width: 300px;height: 150px;">
<h3>获取手机验证码</h3>
<GuipFormItem
column="column"
addClass="w388"
>
<!-- 这个 form-top-icon 类名已经有样式除此布局外需要自定义添加样式 -->
<div slot="formLeft" class="form-top-icon">
<img src="../assets/phone-fill.svg" alt="">
<span>手机号码</span>
</div>
<PhoneCode slot="formDom"></PhoneCode>
</GuipFormItem>
</div>
<div style="display: flex;">
<!-- <GuipButton type="primary" @click="showModal">弹框</GuipButton>
<GuipButton type="primary" @click="showMessage">轻提示</GuipButton>
<GuipButton type="primary" @click="getFormdata">提交</GuipButton> -->
</div>
<div ref="ScaleBox" class="ScaleBox">
<!-- Form 组件-->
<!-- @headdenForm="headdenForm" -->
<!-- @changeSelect="changeSelect" -->
<GuipForm
:fromItem="fromItem"
:formNewList="formList"
:detail="edit"
:disabled="edit"
ref="VabForm"
/>
<div class="cardfooter">
<el-button @click="cancellation">取消</el-button>
<el-button @click="save" type="primary">保存</el-button>
</div>
</div>
</div>
</template>
<script>
import { rules } from "../assets/vabForm";
// @ is an alias to /src
// import GuipRadio from '@/components/GuipRadio.vue';
import GuipFormItem from '@/components/GuipFormItem.vue';
import GuipForm from '@/components/GuipForm.vue';
import PhoneCode from '@/components/PhoneCode.vue';
import GuipButton from '@/components/GuipButton.vue';
// import GuipConfirm from '@/components/GuipConfirm.vue';
import GuipInput from '@/components/GuipInput.vue';
@ -107,7 +250,10 @@
components: {
GuipTextarea,
GuipTable,
GuipForm,
// GuipRadio,
GuipFormItem,
PhoneCode,
GuipButton,
// GuipConfirm,
GuipInput,
@ -116,7 +262,94 @@
},
data(){
return {
form: {
username: ''
},
rules: {
username: [
{ required: true, message: '请输入用户名', trigger: 'blur' }
]
},
msg: "测试",
title: "相关附件",
edit: false,
action: true,
header: false,
width: 1920,
height: 1080,
dataList: [
{ name: "张三", age: 19, id: 1 },
{ name: "李四", age: 20, id: 2 },
],
formList: [],
//
fromItem: {
id: "Shanghai",
id1: "选项4",
name: "用户名",
radioId: "2",
checkboxId: ["上海", "北京"],
textareaIner: "textarea",
dateTime: "2023-09-12 00:00:00",
uploadList: [
{
name: "小梨猫.jpg",
size: 160517,
uid: 1695291434025,
url: "https://ts1.cn.mm.bing.net/th?id=OIP-C.Zte3ljd4g6kqrWWyg-8fhAHaEo&w=316&h=197&c=8&rs=1&qlt=90&o=6&dpr=1.5&pid=3.1&rm=2",
},
],
},
optionss: [
{
value: "选项1",
label: "黄金糕",
},
{
value: "选项2",
label: "双皮奶",
},
{
value: "选项3",
label: "蚵仔煎",
},
{
value: "选项4",
label: "龙须面",
},
{
value: "选项5",
label: "北京烤鸭",
},
],
cities: [
{
value: "Beijing",
label: "北京",
},
{
value: "Shanghai",
label: "上海",
},
{
value: "Nanjing",
label: "南京",
},
{
value: "Chengdu",
label: "成都",
},
{
value: "Shenzhen",
label: "深圳",
},
{
value: "Guangzhou",
label: "广州",
}
],
input:'hahhahah',
defaultValue:'asdasda',
radio:3,
radio1:5,
btnstyleObj:{
@ -137,8 +370,8 @@
height:'40px'
},
styleObject1:{
width:'200px',
height:'38px'
width:'300px',
height:'50px'
},
plain:false,
tableData: [{
@ -189,11 +422,56 @@
}
},
methods:{
submitForm() {
this.$refs.myForm.validate((valid) => {
if (valid) {
alert('提交成功!');
} else {
return false;
}
});
},
triggerError() {
this.$refs.myForm.validateField('username', (error) => {
if (error) {
console.log('错误信息:', error);
} else {
console.log('无错误');
}
});
},
//
radioChange() {
console.log(this.radio,'=====');
}
}
// console.log(this.radio,'=====');
},
getFormdata(){
console.log(this.$refs.GuipInput.value);
},
handleInput(value){
console.log(value,'value===输入框输入得知');
},
handleClear(value){
this.defaultValue = '这是我清除后给的文案'
// this.handleInput('')
console.log(value,'value===qinghcu');
},
getList() {
const dataList = rules();
dataList.forEach((item) => {
if (item.field === "id") {
item.options = this.cities;
}
if (item.field === "id1") {
item.options = this.optionss;
}
});
this.formList = dataList;
},
},
mounted() {
this.getList();
},
}
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save