Commit 790989aa by caoyanzhi

update: init

parent 26559eeb
> 1%
last 2 versions
not dead
module.exports = {
root: true,
env: {
node: true,
},
extends: [
"plugin:vue/essential",
"eslint:recommended",
"plugin:prettier/recommended",
],
parserOptions: {
parser: "@babel/eslint-parser",
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"],
};
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "gic-cli",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "npm run serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "0.18.0",
"core-js": "^3.8.3",
"element-ui": "2.15.6",
"vue": "2.6.6",
"vue-router": "3.0.2",
"vuex": "3.1.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
"@vue/cli-plugin-vuex": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"less": "^4.0.0",
"less-loader": "^8.0.0",
"prettier": "^2.4.1",
"sass": "^1.55.0",
"sass-loader": "^7.3.1",
"vue-template-compiler": "2.6.6"
}
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!-- <title><%= htmlWebpackPlugin.options.title %></title> -->
<title></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script>
(function() {
var src = '/component/static/import-component.js?timestrap='+ new Date().getTime();
var host = window.location.host;
host = host.indexOf('localhost') > -1 ? 'www.gicdev.com' : host;
document.write('<script src="//'+ host + src +'"><\/script>')
})()
</script>
</body>
</html>
<template>
<dm-layout :project-name="projectName">
<keep-alive :include="keepAlive">
<router-view :key="$route.path"></router-view>
</keep-alive>
</dm-layout>
</template>
<script>
import { projectName } from "@/config/index.js";
export default {
name: "App",
data() {
return {
projectName,
keepAlive: [],
};
},
created() {
this.setKeepAlive(this.$route, {});
this.$router.beforeEach((to, from, next) => {
this.setKeepAlive(to, from);
next();
});
},
methods: {
setKeepAlive(to, from) {
if (Array.isArray(to.meta.fromPath)) {
const isKeepAlive = to.meta.fromPath.some((el) => {
let menuUrlReg = el;
let pathConfigReg = /(:.*)(\/?)/;
const pathRegStr = "([\\-]*[\\d\\w]+[\\-]*[\\d\\w]*)";
while (pathConfigReg.test(menuUrlReg)) {
menuUrlReg = menuUrlReg.replace(pathConfigReg, `${pathRegStr}$2`);
}
pathConfigReg = /(\/\*)(\/?)/;
while (pathConfigReg.test(menuUrlReg)) {
menuUrlReg = menuUrlReg.replace(pathConfigReg, `${pathRegStr}$2`);
}
const reg = new RegExp(`^${menuUrlReg}$`);
return reg.test(from.path);
});
if (!isKeepAlive) {
this.keepAlive = this.keepAlive.filter(
(el) => el != to.meta.componentName
);
}
setTimeout(() => {
if (this.keepAlive.every((el) => el != to.meta.componentName)) {
this.keepAlive.push(to.meta.componentName);
}
}, 100);
}
},
},
};
</script>
<style lang="less"></style>
export const projectName = "gic-web";
module.exports = {
publicPath: "/gic-web",
};
import Vue from "vue";
import axios from "axios";
import App from "./App.vue";
import router from "./router";
import store from "./store";
axios.defaults.withCredentials = true;
Vue.config.productionTip = false;
Vue.prototype.axios = axios;
window.getLimit(router, "gic-cli").then(() => {
new Vue({
router,
store,
render: (h) => h(App),
}).$mount("#app");
});
import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";
Vue.use(VueRouter);
const routes = [
{
path: "/",
name: "home",
component: HomeView,
},
{
path: "/about",
name: "about",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () =>
import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
},
];
const router = new VueRouter({
routes,
});
export default router;
import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
export default new Vuex.Store({
state: {},
getters: {},
mutations: {},
actions: {},
modules: {},
});
const { defineConfig } = require("@vue/cli-service");
const { publicPath } = require("./src/config/public-path.js");
const path = require("path");
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: (config) => {
config.resolve.alias = {
"@": path.resolve(__dirname, "./src"),
};
config.externals = {
vue: "Vue",
axios: "axios",
vuex: "Vuex",
"vue-router": "VueRouter",
"element-ui": "ELEMENT",
};
},
css: {
loaderOptions: {
sass: {
prependData: `@import "~@/assets/scss/index.scss";`,
},
},
},
publicPath: publicPath,
productionSourceMap: false,
// 本地运行配置,及反向代理配置
devServer: {
port: 8080,
host: "localhost",
// https: false,
// open: true, // 在服务器启动时自动在浏览器中打开应用程序
// static: {
// publicPath: publicPath,
// },
// 反向代理配置
// proxy: {
// "/api": {
// target: "http://www.gicdev.com", //代理接口
// changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, ""),
// },
// },
},
});
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