Browse Source

fix: eslint

main
xingyu 2 years ago
parent
commit
9ac774cd0a
  1. 3
      src/components/CountDown/src/CountButton.vue
  2. 30
      src/components/FormDesign/src/components/VFormDesign/components/CodeModal.vue
  3. 9
      src/components/FormDesign/src/components/VFormDesign/components/FormNode.vue
  4. 1
      src/layouts/default/setting/components/SelectItem.vue
  5. 1
      src/layouts/default/sider/MixSider.vue
  6. 2
      src/types/module.d.ts
  7. 2
      src/utils/domUtils.ts
  8. 1
      src/utils/index.ts

3
src/components/CountDown/src/CountButton.vue

@ -38,9 +38,8 @@ async function handleStart() {
loading.value = true loading.value = true
try { try {
const canStart = await beforeStartFunc() const canStart = await beforeStartFunc()
if (canStart) if (canStart)
start() start()
} }
finally { finally {
loading.value = false loading.value = false

30
src/components/FormDesign/src/components/VFormDesign/components/CodeModal.vue

@ -27,8 +27,7 @@ export default {
fApi:{}, fApi:{},
formData:{}, formData:{},
formConfig: ` formConfig: `
/* eslint-disable */ const codeVueLast = `
let codeVueLast = `
} }
}, },
methods: { methods: {
@ -38,36 +37,37 @@ let codeVueLast = `
} }
} }
} }
<\/script>`; <\/script>`
// //
const state = reactive({ const state = reactive({
open: false, open: false,
jsonData: {} as IFormConfig, jsonData: {} as IFormConfig,
}); })
const showModal = (formConfig: IFormConfig) => { function showModal(formConfig: IFormConfig) {
formConfig.schemas && formatRules(formConfig.schemas); formConfig.schemas && formatRules(formConfig.schemas)
state.open = true; state.open = true
state.jsonData = formConfig; state.jsonData = formConfig
}; }
const editorVueJson = computed(() => { const editorVueJson = computed(() => {
return codeVueFront + JSON.stringify(removeAttrs(state.jsonData), null, '\t') + codeVueLast; return codeVueFront + JSON.stringify(removeAttrs(state.jsonData), null, '\t') + codeVueLast
}); })
defineExpose({ showModal }) defineExpose({ showModal })
</script> </script>
<template> <template>
<Modal <Modal
title="代码" title="代码"
:footer="null" :footer="null"
:open="state.open" :open="state.open"
@cancel="state.open = false" wrap-class-name="v-code-modal"
wrapClassName="v-code-modal"
style="top: 20px" style="top: 20px"
width="850px" width="850px"
:destroyOnClose="true" :destroy-on-close="true"
@cancel="state.open = false"
> >
<PreviewCode :editorJson="editorVueJson" fileFormat="vue" /> <PreviewCode :editor-json="editorVueJson" file-format="vue" />
</Modal> </Modal>
</template> </template>

9
src/components/FormDesign/src/components/VFormDesign/components/FormNode.vue

@ -9,13 +9,13 @@ import VFormItem from '../../VFormItem/index.vue'
import FormNodeOperate from './FormNodeOperate.vue' import FormNodeOperate from './FormNodeOperate.vue'
const props = defineProps( const props = defineProps(
{ {
schema: { schema: {
type: Object as PropType<IVFormComponent>, type: Object as PropType<IVFormComponent>,
required: true, required: true,
}, },
}, },
) )
const { formConfig, formDesignMethods } = useFormDesignState() const { formConfig, formDesignMethods } = useFormDesignState()
@ -28,8 +28,7 @@ function handleSelectItem() {
<template> <template>
<div <div
class="drag-move-box" class="drag-move-box" :class="{ active: schema.key === formConfig.currentItem?.key }"
:class="{ active: schema.key === formConfig.currentItem?.key }"
@click.stop="handleSelectItem" @click.stop="handleSelectItem"
> >
<div class="form-item-box"> <div class="form-item-box">

1
src/layouts/default/setting/components/SelectItem.vue

@ -43,4 +43,3 @@ function handleChange(e) {
<Select v-bind="getBindValue" class="max-w-32 w-30" :disabled="disabled" :options="options" @change="handleChange" /> <Select v-bind="getBindValue" class="max-w-32 w-30" :disabled="disabled" :options="options" @change="handleChange" />
</div> </div>
</template> </template>

1
src/layouts/default/sider/MixSider.vue

@ -72,7 +72,6 @@ const getIsFixed = computed(() => {
return isFixed return isFixed
}) })
const getDomStyle = computed((): CSSProperties => { const getDomStyle = computed((): CSSProperties => {
const fixedWidth = unref(getIsFixed) ? unref(getRealWidth) : 0 const fixedWidth = unref(getIsFixed) ? unref(getRealWidth) : 0
const width = `${unref(getMixSideWidth) + fixedWidth}px` const width = `${unref(getMixSideWidth) + fixedWidth}px`

2
src/types/module.d.ts vendored

@ -9,7 +9,7 @@ declare module 'ant-design-vue/es/locale/*' {
import type { Locale } from 'ant-design-vue/types/locale-provider' import type { Locale } from 'ant-design-vue/types/locale-provider'
const locale: Locale & ReadonlyRecordable const locale: Locale & ReadonlyRecordable
export default locale export default locale
} }
declare module 'virtual:*' { declare module 'virtual:*' {

2
src/utils/domUtils.ts

@ -167,7 +167,7 @@ export function useRafThrottle<T extends FunctionArgs>(fn: T): T {
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error // @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-invalid-this // eslint-disable-next-line @typescript-eslint/no-invalid-this
fn.apply(this, args) fn.apply(this, args)
locked = false locked = false
}) })

1
src/utils/index.ts

@ -94,6 +94,7 @@ export function openWindow(url: string, opt?: { target?: TargetContext | string;
export function getDynamicProps<T extends Record<string, unknown>, U>(props: T): Partial<U> { export function getDynamicProps<T extends Record<string, unknown>, U>(props: T): Partial<U> {
const ret: Recordable = {} const ret: Recordable = {}
// eslint-disable-next-line array-callback-return
Object.keys(props).map((key) => { Object.keys(props).map((key) => {
ret[key] = unref((props as Recordable)[key]) ret[key] = unref((props as Recordable)[key])
}) })