fix: eslint error

This commit is contained in:
xiaoxian521 2021-07-07 13:33:47 +08:00
parent 62c67a63a3
commit 9044661503
4 changed files with 39 additions and 31 deletions

View File

@ -1,6 +1,6 @@
const productPlugins = [];
const productPlugins = [] process.env.NODE_ENV === "production" &&
process.env.NODE_ENV === "production" && productPlugins.push("transform-remove-console") productPlugins.push("transform-remove-console");
module.exports = { module.exports = {
plugins: [...productPlugins], plugins: [...productPlugins]
} };

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
plugins: [require('autoprefixer'), require('postcss-import')], plugins: [require("autoprefixer"), require("postcss-import")]
}; };

View File

@ -9,7 +9,7 @@
></div> ></div>
</template> </template>
<script lang='ts'> <script lang="ts">
import AMapLoader from "@amap/amap-jsapi-loader"; import AMapLoader from "@amap/amap-jsapi-loader";
import { import {
reactive, reactive,
@ -24,15 +24,22 @@ import { deviceDetection } from "/@/utils/deviceDetection";
import greenCar from "/@/assets/green.png"; import greenCar from "/@/assets/green.png";
let MarkerCluster = <ElRef>null; let MarkerCluster;
export interface MapConfigureInter { export interface MapConfigureInter {
// eslint-disable-next-line no-undef
on: Fn; on: Fn;
// eslint-disable-next-line no-undef
destroy?: Fn; destroy?: Fn;
// eslint-disable-next-line no-undef
clearEvents?: Fn; clearEvents?: Fn;
// eslint-disable-next-line no-undef
addControl?: Fn; addControl?: Fn;
// eslint-disable-next-line no-undef
setCenter?: Fn; setCenter?: Fn;
// eslint-disable-next-line no-undef
setZoom?: Fn; setZoom?: Fn;
// eslint-disable-next-line no-undef
plugin?: Fn; plugin?: Fn;
} }
@ -99,8 +106,9 @@ export default defineComponent({
let { marker, data } = ctx; let { marker, data } = ctx;
if (Array.isArray(data) && data[0]) { if (Array.isArray(data) && data[0]) {
var { driver, plateNumber, orientation } = data[0]; var { driver, plateNumber, orientation } = data[0];
var content = `<img style="transform: scale(1) rotate(${360 - var content = `<img style="transform: scale(1) rotate(${
Number(orientation)}deg);" src='${greenCar}' />`; 360 - Number(orientation)
}deg);" src='${greenCar}' />`;
marker.setContent(content); marker.setContent(content);
marker.setLabel({ marker.setLabel({
direction: "bottom", direction: "bottom",
@ -133,7 +141,7 @@ export default defineComponent({
complete(); complete();
}) })
.catch(err => { .catch(() => {
mapSet.loading = false; mapSet.loading = false;
throw "地图加载失败,请重新加载"; throw "地图加载失败,请重新加载";
}); });

View File

@ -11,18 +11,18 @@ const pathResolve = (dir: string): any => {
return resolve(__dirname, ".", dir); return resolve(__dirname, ".", dir);
}; };
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_OPEN } = loadEnv(); const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY } = loadEnv();
const alias: Record<string, string> = { const alias: Record<string, string> = {
"/@": pathResolve("src"), "/@": pathResolve("src"),
//解决开发环境下的警告 You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle. //解决开发环境下的警告 You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js", "vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js"
}; };
const root: string = process.cwd(); const root: string = process.cwd();
export default ({ command }: ConfigEnv): UserConfigExport => { export default ({ command }: ConfigEnv): UserConfigExport => {
let prodMock = true; const prodMock = true;
return { return {
/** /**
* *
@ -33,7 +33,7 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
process.env.NODE_ENV === "production" ? "/manages/" : VITE_PUBLIC_PATH, process.env.NODE_ENV === "production" ? "/manages/" : VITE_PUBLIC_PATH,
root, root,
resolve: { resolve: {
alias, alias
}, },
// 服务端渲染 // 服务端渲染
server: { server: {
@ -45,7 +45,7 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
*/ */
port: VITE_PORT, port: VITE_PORT,
// 本地跨域代理 // 本地跨域代理
proxy: createProxy(VITE_PROXY), proxy: createProxy(VITE_PROXY)
}, },
plugins: [ plugins: [
vue(), vue(),
@ -57,21 +57,21 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
libraryName: "element-plus", libraryName: "element-plus",
esModule: true, esModule: true,
ensureStyleFile: true, ensureStyleFile: true,
resolveStyle: (name) => { resolveStyle: name => {
return `element-plus/lib/theme-chalk/${name}.css`; return `element-plus/lib/theme-chalk/${name}.css`;
}, },
resolveComponent: (name) => { resolveComponent: name => {
return `element-plus/lib/${name}`; return `element-plus/lib/${name}`;
}, }
}, },
// 按需加载vxe-table // 按需加载vxe-table
{ {
libraryName: "vxe-table", libraryName: "vxe-table",
esModule: true, esModule: true,
resolveComponent: (name) => `vxe-table/es/${name}`, resolveComponent: name => `vxe-table/es/${name}`,
resolveStyle: (name) => `vxe-table/es/${name}/style.css`, resolveStyle: name => `vxe-table/es/${name}/style.css`
}, }
], ]
}), }),
viteMockServe({ viteMockServe({
mockPath: "mock", mockPath: "mock",
@ -81,24 +81,24 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
import { setupProdMockServer } from './mockProdServer'; import { setupProdMockServer } from './mockProdServer';
setupProdMockServer(); setupProdMockServer();
`, `,
logger: true, logger: true
}), })
], ],
optimizeDeps: { optimizeDeps: {
include: [ include: [
"element-plus/lib/locale/lang/zh-cn", "element-plus/lib/locale/lang/zh-cn",
"element-plus/lib/locale/lang/en", "element-plus/lib/locale/lang/en",
"vxe-table/lib/locale/lang/zh-CN", "vxe-table/lib/locale/lang/zh-CN",
"vxe-table/lib/locale/lang/en-US", "vxe-table/lib/locale/lang/en-US"
], ]
}, },
build: { build: {
brotliSize: false, brotliSize: false,
// 消除打包大小超过500kb警告 // 消除打包大小超过500kb警告
chunkSizeWarningLimit: 2000, chunkSizeWarningLimit: 2000
}, },
define: { define: {
__INTLIFY_PROD_DEVTOOLS__: false, __INTLIFY_PROD_DEVTOOLS__: false
}, }
}; };
}; };