forked from fdzcxy212206413/jty
				
			
						commit
						f708fef845
					
				@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					APP_FLAG=dev
 | 
				
			||||||
@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					APP_FLAG=prod
 | 
				
			||||||
@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					APP_FLAG=staging
 | 
				
			||||||
@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					# Logs
 | 
				
			||||||
 | 
					logs
 | 
				
			||||||
 | 
					*.log
 | 
				
			||||||
 | 
					npm-debug.log*
 | 
				
			||||||
 | 
					yarn-debug.log*
 | 
				
			||||||
 | 
					yarn-error.log*
 | 
				
			||||||
 | 
					pnpm-debug.log*
 | 
				
			||||||
 | 
					lerna-debug.log*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					node_modules
 | 
				
			||||||
 | 
					dist
 | 
				
			||||||
 | 
					dist-ssr
 | 
				
			||||||
 | 
					*.local
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Editor directories and files
 | 
				
			||||||
 | 
					.vscode/*
 | 
				
			||||||
 | 
					!.vscode/extensions.json
 | 
				
			||||||
 | 
					.idea
 | 
				
			||||||
 | 
					.DS_Store
 | 
				
			||||||
 | 
					*.suo
 | 
				
			||||||
 | 
					*.ntvs*
 | 
				
			||||||
 | 
					*.njsproj
 | 
				
			||||||
 | 
					*.sln
 | 
				
			||||||
 | 
					*.sw?
 | 
				
			||||||
@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					# view-ui-project-vite
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A template project for vue3, vue-router, vuex, ViewUIPlus and vite.
 | 
				
			||||||
@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html lang="en">
 | 
				
			||||||
 | 
					  <head>
 | 
				
			||||||
 | 
					    <meta charset="UTF-8" />
 | 
				
			||||||
 | 
					    <link rel="icon" href="/favicon.ico" />
 | 
				
			||||||
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 | 
				
			||||||
 | 
					    <title><%- APP_TITLE %></title>
 | 
				
			||||||
 | 
					  </head>
 | 
				
			||||||
 | 
					  <body>
 | 
				
			||||||
 | 
					    <div id="app"></div>
 | 
				
			||||||
 | 
					    <script type="module" src="/src/main.js"></script>
 | 
				
			||||||
 | 
					  </body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
											
												
													File diff suppressed because it is too large
													Load Diff
												
											
										
									
								@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					  "name": "view-ui-project-vite",
 | 
				
			||||||
 | 
					  "version": "1.0.0",
 | 
				
			||||||
 | 
					  "description": "a template project for vue3, vue-router, vuex, ViewUIPlus and vite.",
 | 
				
			||||||
 | 
					  "scripts": {
 | 
				
			||||||
 | 
					    "serve": "npm run dev",
 | 
				
			||||||
 | 
					    "dev": "vite serve",
 | 
				
			||||||
 | 
					    "build": "vite build",
 | 
				
			||||||
 | 
					    "build:staging": "vite build --mode=staging",
 | 
				
			||||||
 | 
					    "preview": "npm run build && vite preview",
 | 
				
			||||||
 | 
					    "preview:staging": "npm run build:staging && vite preview --mode=staging"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "dependencies": {
 | 
				
			||||||
 | 
					    "axios": "^0.27.0",
 | 
				
			||||||
 | 
					    "view-design": "^4.7.0",
 | 
				
			||||||
 | 
					    "vue": "^3.2.25",
 | 
				
			||||||
 | 
					    "vue-router": "^4.0.14",
 | 
				
			||||||
 | 
					    "vuex": "^4.0.2"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "devDependencies": {
 | 
				
			||||||
 | 
					    "@vitejs/plugin-vue": "^2.3.1",
 | 
				
			||||||
 | 
					    "autoprefixer": "^10.4.5",
 | 
				
			||||||
 | 
					    "less": "^4.1.2",
 | 
				
			||||||
 | 
					    "less-loader": "^10.2.0",
 | 
				
			||||||
 | 
					    "mockjs": "^1.1.0",
 | 
				
			||||||
 | 
					    "vite": "^2.9.5",
 | 
				
			||||||
 | 
					    "vite-plugin-html": "^3.2.0"
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "engines": {
 | 
				
			||||||
 | 
					    "node": ">= 12.0.0",
 | 
				
			||||||
 | 
					    "npm": ""
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "browserslist": [
 | 
				
			||||||
 | 
					    "> 1%",
 | 
				
			||||||
 | 
					    "last 2 versions"
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 4.2 KiB  | 
@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <router-view/>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					  export default {
 | 
				
			||||||
 | 
					    name: 'App'
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 6.7 KiB  | 
@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <div class="demo">
 | 
				
			||||||
 | 
					    <Button type="primary" @click="handleClick">Welcome!</Button>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					  export default {
 | 
				
			||||||
 | 
					    name: 'Demo',
 | 
				
			||||||
 | 
					    setup() {
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    methods: {
 | 
				
			||||||
 | 
					      handleClick() {
 | 
				
			||||||
 | 
					        this.$Message.success('Welcome to ViewUIPlus Demo!')
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style lang="less" scoped>
 | 
				
			||||||
 | 
					  .demo{
 | 
				
			||||||
 | 
					    color: lightcoral;
 | 
				
			||||||
 | 
					    font-size: @font-size;
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    margin: 300px 0 0 0;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					import { createApp } from 'vue'
 | 
				
			||||||
 | 
					import App from './App.vue'
 | 
				
			||||||
 | 
					import router from './router'
 | 
				
			||||||
 | 
					import store from './store'
 | 
				
			||||||
 | 
					import ViewUIPlus from 'view-design'
 | 
				
			||||||
 | 
					import 'view-design/dist/styles/viewuiplus.css'
 | 
				
			||||||
 | 
					import './styles'
 | 
				
			||||||
 | 
					// import './mock'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const app = createApp(App)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					app.use(router)
 | 
				
			||||||
 | 
					  .use(store)
 | 
				
			||||||
 | 
					  .use(ViewUIPlus)
 | 
				
			||||||
 | 
					  .mount('#app')
 | 
				
			||||||
@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					import Mock from 'mockjs'
 | 
				
			||||||
 | 
					import './user'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Mock.setup({ timeout: 300 })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default Mock
 | 
				
			||||||
@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					import Mock from 'mockjs'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Mock.mock(/\/userList/, 'get', {
 | 
				
			||||||
 | 
					  code: 200,
 | 
				
			||||||
 | 
					  data: [
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      id: '@id',
 | 
				
			||||||
 | 
					      name: '@name'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					import { createRouter, createWebHistory } from 'vue-router'
 | 
				
			||||||
 | 
					import Home from '@/views/Home.vue'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const routes = [
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    path: '/',
 | 
				
			||||||
 | 
					    redirect: '/home'
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    path: '/home',
 | 
				
			||||||
 | 
					    name: 'home',
 | 
				
			||||||
 | 
					    component: Home
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const router = createRouter({
 | 
				
			||||||
 | 
					  routes,
 | 
				
			||||||
 | 
					  history: createWebHistory(),
 | 
				
			||||||
 | 
					  scrollBehavior() {
 | 
				
			||||||
 | 
					    return { top: 0 }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default router
 | 
				
			||||||
@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					import { createStore } from 'vuex'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default createStore({
 | 
				
			||||||
 | 
					  state: {},
 | 
				
			||||||
 | 
					  mutations: {},
 | 
				
			||||||
 | 
					  actions: {},
 | 
				
			||||||
 | 
					  modules: {}
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					@import "./reset.less";
 | 
				
			||||||
@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					html, body{
 | 
				
			||||||
 | 
					  margin: 0;
 | 
				
			||||||
 | 
					  padding: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					@font-size: 16px;
 | 
				
			||||||
@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					<template>
 | 
				
			||||||
 | 
					  <Demo/>
 | 
				
			||||||
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<script>
 | 
				
			||||||
 | 
					  import Demo from '@/components/Demo'
 | 
				
			||||||
 | 
					  export default {
 | 
				
			||||||
 | 
					    name: 'Home',
 | 
				
			||||||
 | 
					    components: {
 | 
				
			||||||
 | 
					      Demo
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    setup() {
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    methods: {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<style lang="less" scoped>
 | 
				
			||||||
 | 
					</style>
 | 
				
			||||||
@ -0,0 +1,75 @@
 | 
				
			|||||||
 | 
					import { defineConfig, loadEnv } from 'vite'
 | 
				
			||||||
 | 
					import vue from '@vitejs/plugin-vue'
 | 
				
			||||||
 | 
					import autoprefixer from 'autoprefixer'
 | 
				
			||||||
 | 
					import { createHtmlPlugin } from 'vite-plugin-html'
 | 
				
			||||||
 | 
					import path from 'path'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const config = ({ mode }) => {
 | 
				
			||||||
 | 
					  const isProd = mode === 'production'
 | 
				
			||||||
 | 
					  const envPrefix = 'APP_'
 | 
				
			||||||
 | 
					  const { APP_TITLE = '' } = loadEnv(mode, process.cwd(), envPrefix)
 | 
				
			||||||
 | 
					  return {
 | 
				
			||||||
 | 
					    plugins: [
 | 
				
			||||||
 | 
					      vue(),
 | 
				
			||||||
 | 
					      createHtmlPlugin({
 | 
				
			||||||
 | 
					        minify: isProd,
 | 
				
			||||||
 | 
					        inject: {
 | 
				
			||||||
 | 
					          data: {
 | 
				
			||||||
 | 
					            title: APP_TITLE,
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    build: {
 | 
				
			||||||
 | 
					      target: 'es2015',
 | 
				
			||||||
 | 
					      outDir: path.resolve(__dirname, 'dist'),
 | 
				
			||||||
 | 
					      assetsDir: 'assets',
 | 
				
			||||||
 | 
					      assetsInlineLimit: 1, //8192,
 | 
				
			||||||
 | 
					      sourcemap: isProd ? 'hidden' : true,
 | 
				
			||||||
 | 
					      emptyOutDir: true,
 | 
				
			||||||
 | 
					      rollupOptions: {
 | 
				
			||||||
 | 
					        input: path.resolve(__dirname, 'index.html'),
 | 
				
			||||||
 | 
					        output: {
 | 
				
			||||||
 | 
					          chunkFileNames: "js/[name].[hash].js",
 | 
				
			||||||
 | 
					          entryFileNames: "js/[name].[hash].js",
 | 
				
			||||||
 | 
					          assetFileNames: "[ext]/[name].[hash].[ext]",
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    envPrefix,
 | 
				
			||||||
 | 
					    resolve: {
 | 
				
			||||||
 | 
					      alias: {
 | 
				
			||||||
 | 
					        '@': path.resolve(__dirname, 'src'),
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      extensions: ['.js', '.mjs', '.vue', '.json', '.less', '.css']
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    css: {
 | 
				
			||||||
 | 
					      postcss: {
 | 
				
			||||||
 | 
					        plugins: [
 | 
				
			||||||
 | 
					          autoprefixer
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      preprocessorOptions: {
 | 
				
			||||||
 | 
					        less: {
 | 
				
			||||||
 | 
					          javascriptEnabled: true,
 | 
				
			||||||
 | 
					          additionalData: `@import "${path.resolve(__dirname, 'src/styles/variable.less')}";`
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    server: {
 | 
				
			||||||
 | 
					      open: true,
 | 
				
			||||||
 | 
					      port: 8080,
 | 
				
			||||||
 | 
					      proxy: {
 | 
				
			||||||
 | 
					        '/api': {
 | 
				
			||||||
 | 
					          target: 'http://localhost:8080',
 | 
				
			||||||
 | 
					          changeOrigin: true
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    preview: {
 | 
				
			||||||
 | 
					      port: 5000
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default defineConfig(config)
 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue