fix: fix Form component setProps not work bug

This commit is contained in:
kailong321200875 2022-01-30 11:09:53 +08:00
parent 33eca8a97d
commit 48ffc52ca8
7 changed files with 4582 additions and 4008 deletions

View File

@ -25,19 +25,19 @@
"postinstall": "husky install"
},
"dependencies": {
"@iconify/iconify": "^2.1.1",
"@vueuse/core": "^7.5.4",
"@iconify/iconify": "^2.1.2",
"@vueuse/core": "^7.5.5",
"@zxcvbn-ts/core": "^1.2.0",
"animate.css": "^4.1.1",
"axios": "^0.25.0",
"echarts": "^5.2.2",
"echarts": "^5.3.0",
"echarts-wordcloud": "^2.0.0",
"element-plus": "1.3.0-beta.7",
"element-plus": "1.3.0-beta.9",
"intro.js": "^4.3.0",
"lodash-es": "^4.17.21",
"mockjs": "^1.1.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.9",
"pinia": "^2.0.10",
"qrcode": "^1.5.0",
"qs": "^6.10.3",
"vue": "3.2.26",
@ -49,36 +49,36 @@
"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@iconify/json": "^1.1.459",
"@iconify/json": "^2.0.30",
"@intlify/vite-plugin-vue-i18n": "^3.2.1",
"@purge-icons/generated": "^0.7.0",
"@types/intro.js": "^3.0.2",
"@types/lodash-es": "^4.17.5",
"@types/node": "^17.0.10",
"@types/node": "^17.0.13",
"@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.4.2",
"@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.10.0",
"@typescript-eslint/parser": "^5.10.0",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"@vitejs/plugin-vue": "^2.1.0",
"@vitejs/plugin-vue-jsx": "^1.3.3",
"autoprefixer": "^10.4.2",
"commitizen": "^4.2.4",
"eslint": "^8.7.0",
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-define-config": "^1.2.3",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.3.0",
"eslint-plugin-vue": "^8.4.0",
"husky": "^7.0.4",
"less": "^4.1.2",
"lint-staged": "^12.2.2",
"lint-staged": "^12.3.2",
"postcss": "^8.4.5",
"postcss-html": "^1.3.0",
"postcss-less": "^6.0.0",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
"rimraf": "^3.0.2",
"stylelint": "^14.2.0",
"stylelint": "^14.3.0",
"stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^24.0.0",
@ -89,8 +89,8 @@
"vite-plugin-mock": "^2.9.6",
"vite-plugin-purge-icons": "^0.7.0",
"vite-plugin-style-import": "^1.4.1",
"vite-plugin-svg-icons": "^1.1.0",
"vite-plugin-vue-setup-extend": "^0.3.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vite-plugin-windicss": "^1.6.3",
"vue-tsc": "^0.31.1",
"windicss": "^3.4.3",

File diff suppressed because it is too large Load Diff

View File

@ -54,13 +54,11 @@ export default defineComponent({
// useFormprops
const outsideProps = ref<FormProps>({})
const mergeProps = ref<FormProps>({})
const getProps = computed(() => {
const propsObj = { ...props }
for (const key in unref(outsideProps)) {
if (Reflect.has(propsObj, key)) {
propsObj[key] = unref(outsideProps)[key]
}
}
Object.assign(propsObj, unref(mergeProps))
return propsObj
})
@ -77,6 +75,7 @@ export default defineComponent({
}
const setProps = (props: FormProps = {}) => {
mergeProps.value = Object.assign(unref(mergeProps), props)
outsideProps.value = props
}

View File

@ -82,7 +82,22 @@ const bottonButtonStyle = computed(() => {
:schema="newSchema"
@register="register"
>
<template v-if="layout === 'inline'" #action>
<template #action>
<div v-if="layout === 'inline'">
<ElButton v-if="showSearch" type="primary" @click="search">
<Icon icon="ep:search" class="mr-5px" />
{{ t('common.query') }}
</ElButton>
<ElButton v-if="showReset" @click="reset">
<Icon icon="ep:refresh-right" class="mr-5px" />
{{ t('common.reset') }}
</ElButton>
</div>
</template>
</Form>
<template v-if="layout === 'bottom'">
<div :style="bottonButtonStyle">
<ElButton v-if="showSearch" type="primary" @click="search">
<Icon icon="ep:search" class="mr-5px" />
{{ t('common.query') }}
@ -91,16 +106,6 @@ const bottonButtonStyle = computed(() => {
<Icon icon="ep:refresh-right" class="mr-5px" />
{{ t('common.reset') }}
</ElButton>
</template>
</Form>
<div v-if="layout === 'bottom'" :style="bottonButtonStyle">
<ElButton v-if="showSearch" type="primary" @click="search">
<Icon icon="ep:search" class="mr-5px" />
{{ t('common.query') }}
</ElButton>
<ElButton v-if="showReset" @click="reset">
<Icon icon="ep:refresh-right" class="mr-5px" />
{{ t('common.reset') }}
</ElButton>
</div>
</div>
</template>
</template>

View File

@ -177,7 +177,7 @@ export const radarOption: EChartsOption = {
name: t('workplace.personal')
},
{
value: [50, 140, 28, 35, 90],
value: [50, 140, 290, 100, 90],
name: t('workplace.team')
}
]

View File

@ -28,7 +28,8 @@
"vite/client",
"element-plus/global",
"@types/intro.js",
"@types/qrcode"
"@types/qrcode",
"vite-plugin-svg-icons/client"
],
"typeRoots": ["./node_modules/@types/", "./types"]
},

View File

@ -7,7 +7,7 @@ import VueJsx from '@vitejs/plugin-vue-jsx'
import EslintPlugin from 'vite-plugin-eslint'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
import StyleImport, { ElementPlusResolve } from 'vite-plugin-style-import'
import ViteSvgIcons from 'vite-plugin-svg-icons'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import PurgeIcons from 'vite-plugin-purge-icons'
import { viteMockServe } from 'vite-plugin-mock'
import VueSetupExtend from 'vite-plugin-vue-setup-extend'
@ -53,7 +53,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
compositionOnly: true,
include: [resolve(__dirname, 'src/locales/**')]
}),
ViteSvgIcons({
createSvgIconsPlugin({
iconDirs: [pathResolve('src/assets/svgs')],
symbolId: 'icon-[dir]-[name]',
svgoOptions: true