wip: example demo developing

This commit is contained in:
kailong321200875 2022-02-13 11:08:11 +08:00
parent ef35bde801
commit 6c57a34512
4 changed files with 921 additions and 630 deletions

View File

@ -2,11 +2,7 @@
/config/ /config/
/dist/ /dist/
/*.js /*.js
/*.d.ts
/test/unit/coverage/ /test/unit/coverage/
/node_modules/* /node_modules/*
/src/types/env.d.ts
/dist* /dist*
/src/main.ts /src/main.ts
/src/types/auto-imports.d.ts
/src/types/components.d.ts

View File

@ -26,10 +26,10 @@
}, },
"dependencies": { "dependencies": {
"@iconify/iconify": "^2.1.2", "@iconify/iconify": "^2.1.2",
"@vueuse/core": "^7.6.0", "@vueuse/core": "^7.6.1",
"@wangeditor/editor": "^0.14.3", "@wangeditor/editor": "^0.15.1",
"@wangeditor/editor-for-vue": "^5.1.8-7", "@wangeditor/editor-for-vue": "^5.1.8-7",
"@zxcvbn-ts/core": "^1.2.0", "@zxcvbn-ts/core": "^2.0.0",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^0.25.0", "axios": "^0.25.0",
"echarts": "^5.3.0", "echarts": "^5.3.0",
@ -51,19 +51,19 @@
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^16.1.0", "@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0", "@commitlint/config-conventional": "^16.0.0",
"@iconify/json": "^2.0.34", "@iconify/json": "^2.0.36",
"@intlify/vite-plugin-vue-i18n": "^3.2.2", "@intlify/vite-plugin-vue-i18n": "^3.2.2",
"@purge-icons/generated": "^0.7.0", "@purge-icons/generated": "^0.7.0",
"@types/intro.js": "^3.0.2", "@types/intro.js": "^3.0.2",
"@types/lodash-es": "^4.17.6", "@types/lodash-es": "^4.17.6",
"@types/node": "^17.0.16", "@types/node": "^17.0.17",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.4.2", "@types/qrcode": "^1.4.2",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.11.0", "@typescript-eslint/eslint-plugin": "^5.11.0",
"@typescript-eslint/parser": "^5.11.0", "@typescript-eslint/parser": "^5.11.0",
"@vitejs/plugin-vue": "^2.1.0", "@vitejs/plugin-vue": "^2.2.0",
"@vitejs/plugin-vue-jsx": "^1.3.3", "@vitejs/plugin-vue-jsx": "^1.3.4",
"autoprefixer": "^10.4.2", "autoprefixer": "^10.4.2",
"commitizen": "^4.2.4", "commitizen": "^4.2.4",
"consola": "^2.15.3", "consola": "^2.15.3",
@ -82,13 +82,13 @@
"prettier": "^2.5.1", "prettier": "^2.5.1",
"pretty-quick": "^3.1.3", "pretty-quick": "^3.1.3",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"stylelint": "^14.4.0", "stylelint": "^14.5.0",
"stylelint-config-html": "^1.0.0", "stylelint-config-html": "^1.0.0",
"stylelint-config-prettier": "^9.0.3", "stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^25.0.0", "stylelint-config-standard": "^25.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"typescript": "4.5.5", "typescript": "4.5.5",
"vite": "2.7.13", "vite": "2.8.0",
"vite-plugin-eslint": "^1.3.0", "vite-plugin-eslint": "^1.3.0",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-plugin-purge-icons": "^0.7.0", "vite-plugin-purge-icons": "^0.7.0",

File diff suppressed because it is too large Load Diff

View File

@ -47,44 +47,38 @@ const columns = reactive<TableColumn[]>([
type: 'index' type: 'index'
}, },
{ {
field: 'content', field: 'title',
label: t('tableDemo.header'), label: t('tableDemo.title')
children: [ },
{ {
field: 'title', field: 'author',
label: t('tableDemo.title') label: t('tableDemo.author')
}, },
{ {
field: 'author', field: 'display_time',
label: t('tableDemo.author') label: t('tableDemo.displayTime')
}, },
{ {
field: 'display_time', field: 'importance',
label: t('tableDemo.displayTime') label: t('tableDemo.importance'),
}, formatter: (_: Recordable, __: TableColumn, cellValue: number) => {
{ return h(
field: 'importance', ElTag,
label: t('tableDemo.importance'), {
formatter: (_: Recordable, __: TableColumn, cellValue: number) => { type: cellValue === 1 ? 'success' : cellValue === 2 ? 'warning' : 'danger'
return h( },
ElTag, () =>
{ cellValue === 1
type: cellValue === 1 ? 'success' : cellValue === 2 ? 'warning' : 'danger' ? t('tableDemo.important')
}, : cellValue === 2
() => ? t('tableDemo.good')
cellValue === 1 : t('tableDemo.commonly')
? t('tableDemo.important') )
: cellValue === 2 }
? t('tableDemo.good') },
: t('tableDemo.commonly') {
) field: 'pageviews',
} label: t('tableDemo.pageviews')
},
{
field: 'pageviews',
label: t('tableDemo.pageviews')
}
]
}, },
{ {
field: 'action', field: 'action',
@ -107,12 +101,11 @@ const writeRef = ref<ComponentRef<typeof Write>>()
const loading = ref(false) const loading = ref(false)
const save = async () => { const save = async () => {
loading.value = true
const write = unref(writeRef) const write = unref(writeRef)
const validate = await write?.elFormRef?.validate()?.catch(() => {}) const validate = await write?.elFormRef?.validate()?.catch(() => {})
if (validate) { if (validate) {
loading.value = true
const data = await write?.getFormData() const data = await write?.getFormData()
const res = await saveTableApi({ const res = await saveTableApi({
data data
}) })