Commit 7a68aee6 authored by liaozan's avatar liaozan 🏀

feat: rewrite with vue3

parent 0c0b7062
......@@ -6,18 +6,14 @@
"build": "vite build --mode production"
},
"dependencies": {
"@vitejs/plugin-vue": "^2.3.1",
"ant-design-vue": "^3.1.1",
"axios": "^0.26.1",
"consola": "^2.15.3",
"vite-plugin-style-import": "^1.4.1",
"vue": "^3.2.31"
},
"devDependencies": {
"@vue/compiler-sfc": "^3.2.31",
"less": "^4.1.2",
"sass": "^1.50.0",
"unplugin-vue-components": "^0.18.5",
"vite": "^2.9.1"
"@vitejs/plugin-vue": "^2.3.1",
"typescript": "^4.6.3",
"vite": "^2.9.1",
"vue-tsc": "^0.33.9"
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
<div class="start-wrapper">
<a-spin :spinning="loading">
<h3 style="margin-bottom: 20px">项目初始代码生成</h3>
<a-form ref="downloadForm" :labelCol="{span: 6}" :model="formState" :rules="formRules" :wrapperCol="{span: 18}" class="form-wrapper">
<a-form ref="downloadForm" :labelCol="{span: 6}" :model="formState" :rules="formRules" :wrapperCol="{span: 18}" autocomplete="off" class="form-wrapper">
<a-form-item has-feedback label="GroupId" name="groupId">
<a-input v-model:value="formState.groupId"/>
</a-form-item>
......@@ -121,50 +121,39 @@ const createTreeData = (fileNodeList: FileNode[]): any => {
return []
}
return fileNodeList.map((item: FileNode) => {
// 非叶子结点
if (item.children && item.children.length > 0) {
Object.assign(item, {
key: item.fileContent! + Math.random(),
children: createTreeData(item.children),
title: item.fileName,
selectable: false,
isLeaf: false
})
return item
} else {
return {
key: item.fileContent! + Math.random(),
key: Math.random(),
title: item.fileName,
children: [],
children: createTreeData(item.children),
selectable: false,
isLeaf: true
}
isLeaf: item.isFile
}
})
}
</script>
<style lang="scss" scoped>
<style scoped>
.start-wrapper {
width: 500px;
min-height: 300px;
border-radius: 8px;
box-shadow: 0 0 20px gray;
margin: 100px auto;
padding: 50px;
padding: 50px
}
.button-group {
.button-group {
display: flex;
justify-content: center;
align-items: center;
align-items: center
}
.generic-btn {
.generic-btn {
margin-left: 10px;
}
}
}
:deep(.ant-input), :deep(.ant-btn) {
/*noinspection CssUnusedSymbol*/
.ant-input, .ant-btn {
border-radius: 6px;
}
}
</style>
\ No newline at end of file
import {createApp} from 'vue'
import App from './App.vue'
import Antd from 'ant-design-vue'
import './index.css'
import 'ant-design-vue/dist/antd.css';
createApp(App).mount('#app')
\ No newline at end of file
createApp(App).use(Antd).mount('#app')
\ No newline at end of file
import Components from 'unplugin-vue-components/vite'
import {AntDesignVueResolver} from 'unplugin-vue-components/resolvers'
import styleImport, {AndDesignVueResolve, AntdResolve} from 'vite-plugin-style-import'
import {defineConfig} from 'vite'
// @ts-ignore
import vue from '@vitejs/plugin-vue'
// noinspection JSUnusedGlobalSymbols
export default defineConfig({
plugins: [
vue(),
// antd自动按需引入
Components({
resolvers: [
AntDesignVueResolver(),
]
}),
// @ts-ignore
styleImport({
resolves: [
AndDesignVueResolve(),
AntdResolve()
],
// 自定义规则
libs: [
{
libraryName: 'ant-design-vue',
esModule: true,
resolveStyle: (name: any) => {
return `ant-design-vue/es/${name}/style/index`
}
}
]
})
],
// 引用使用less的库要配置一下
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
}
},
// 让terminal显示network地址
server: {
host: '0.0.0.0'
}
plugins: [vue()]
})
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment