mirror of
https://github.com/ecomfe/vue-echarts.git
synced 2025-08-19 15:48:08 +08:00
chore: ESLint Flat Config (#834)
* chore: eslint flat config * chore: format * update according to review * chore: remove prettier config and format * fix: move handler to script to bypass eslint * chore: config eslint for lang=js block * docs: add surrounding empty lines for code block * chore: also minify css in csp build * chore: publint
This commit is contained in:
@ -5,7 +5,7 @@ import {
|
||||
watch,
|
||||
onBeforeUnmount,
|
||||
onMounted,
|
||||
nextTick
|
||||
nextTick,
|
||||
} from "vue";
|
||||
import { useLocalStorage } from "@vueuse/core";
|
||||
import "highlight.js/styles/github.css";
|
||||
@ -29,7 +29,7 @@ const codegenOptions = useLocalStorage("ve.codegenOptions", {
|
||||
multiline: false,
|
||||
maxLen: 80,
|
||||
semi: false,
|
||||
includeType: false
|
||||
includeType: false,
|
||||
});
|
||||
|
||||
const props = defineProps({ open: Boolean, renderer: String });
|
||||
@ -38,6 +38,10 @@ const emit = defineEmits(["update:open"]);
|
||||
const dialog = ref(null);
|
||||
let clickFrom = null;
|
||||
|
||||
function onMousedown(e) {
|
||||
clickFrom = e.target;
|
||||
}
|
||||
|
||||
function closeFromOutside() {
|
||||
if (dialog.value?.contains(clickFrom)) {
|
||||
return;
|
||||
@ -53,7 +57,7 @@ const renderer = ref(props.renderer);
|
||||
const source = ref(null);
|
||||
watch(
|
||||
() => props.open,
|
||||
async val => {
|
||||
async (val) => {
|
||||
if (val) {
|
||||
renderer.value = props.renderer;
|
||||
}
|
||||
@ -64,7 +68,7 @@ watch(
|
||||
return;
|
||||
}
|
||||
source.value?.focus();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const copied = ref(false);
|
||||
@ -119,7 +123,7 @@ onMounted(async () => {
|
||||
source.value?.focus();
|
||||
});
|
||||
|
||||
watch(optionCode, async val => {
|
||||
watch(optionCode, async (val) => {
|
||||
try {
|
||||
transformedCode.value = await transform(`(${val})`, { loader: "ts" });
|
||||
transformErrors.value = [];
|
||||
@ -160,7 +164,7 @@ const importCode = computed(() => {
|
||||
try {
|
||||
return getImportsFromOption(eval(transformedCode.value.code), {
|
||||
renderer: renderer.value,
|
||||
...codegenOptions.value
|
||||
...codegenOptions.value,
|
||||
});
|
||||
} catch (e) {
|
||||
return `/* Invalid ECharts option */
|
||||
@ -209,7 +213,7 @@ onBeforeUnmount(() => {
|
||||
<aside
|
||||
class="modal"
|
||||
:class="{ open: props.open }"
|
||||
@mousedown="clickFrom = $event.target"
|
||||
@mousedown="onMousedown"
|
||||
@click="closeFromOutside"
|
||||
@keydown.esc="close"
|
||||
>
|
||||
|
Reference in New Issue
Block a user