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 = []
process.env.NODE_ENV === "production" && productPlugins.push("transform-remove-console")
const productPlugins = [];
process.env.NODE_ENV === "production" &&
productPlugins.push("transform-remove-console");
module.exports = {
plugins: [...productPlugins],
}
plugins: [...productPlugins]
};

View File

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

View File

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

View File

@ -11,18 +11,18 @@ const pathResolve = (dir: string): any => {
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> = {
"/@": 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.
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js",
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js"
};
const root: string = process.cwd();
export default ({ command }: ConfigEnv): UserConfigExport => {
let prodMock = true;
const prodMock = true;
return {
/**
*
@ -33,7 +33,7 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
process.env.NODE_ENV === "production" ? "/manages/" : VITE_PUBLIC_PATH,
root,
resolve: {
alias,
alias
},
// 服务端渲染
server: {
@ -45,7 +45,7 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
*/
port: VITE_PORT,
// 本地跨域代理
proxy: createProxy(VITE_PROXY),
proxy: createProxy(VITE_PROXY)
},
plugins: [
vue(),
@ -57,21 +57,21 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
libraryName: "element-plus",
esModule: true,
ensureStyleFile: true,
resolveStyle: (name) => {
resolveStyle: name => {
return `element-plus/lib/theme-chalk/${name}.css`;
},
resolveComponent: (name) => {
resolveComponent: name => {
return `element-plus/lib/${name}`;
},
}
},
// 按需加载vxe-table
{
libraryName: "vxe-table",
esModule: true,
resolveComponent: (name) => `vxe-table/es/${name}`,
resolveStyle: (name) => `vxe-table/es/${name}/style.css`,
},
],
resolveComponent: name => `vxe-table/es/${name}`,
resolveStyle: name => `vxe-table/es/${name}/style.css`
}
]
}),
viteMockServe({
mockPath: "mock",
@ -81,24 +81,24 @@ export default ({ command }: ConfigEnv): UserConfigExport => {
import { setupProdMockServer } from './mockProdServer';
setupProdMockServer();
`,
logger: true,
}),
logger: true
})
],
optimizeDeps: {
include: [
"element-plus/lib/locale/lang/zh-cn",
"element-plus/lib/locale/lang/en",
"vxe-table/lib/locale/lang/zh-CN",
"vxe-table/lib/locale/lang/en-US",
],
"vxe-table/lib/locale/lang/en-US"
]
},
build: {
brotliSize: false,
// 消除打包大小超过500kb警告
chunkSizeWarningLimit: 2000,
chunkSizeWarningLimit: 2000
},
define: {
__INTLIFY_PROD_DEVTOOLS__: false,
},
__INTLIFY_PROD_DEVTOOLS__: false
}
};
};