Browse Source

style(eslint): fix eslint error

Vben 4 years ago
parent
commit
3c441a05da

+ 3 - 1
src/components/Application/src/search/AppSearchKeyItem.vue

@@ -1,11 +1,13 @@
 <template>
   <span :class="$attrs.class">
-    <g-icon :icon="icon" />
+    <Icon :icon="icon" />
   </span>
 </template>
 <script lang="ts">
   import { defineComponent } from 'vue';
+  import { Icon } from '/@/components/Icon';
   export default defineComponent({
+    components: { Icon },
     props: {
       icon: String,
     },

+ 3 - 3
src/components/Application/src/search/AppSearchModal.vue

@@ -4,7 +4,7 @@
       <div :class="getClass" @click.stop v-if="visible">
         <div :class="`${prefixCls}-content`" v-click-outside="handleClose">
           <div :class="`${prefixCls}-input__wrapper`">
-            <a-input
+            <Input
               :class="`${prefixCls}-input`"
               :placeholder="t('common.searchText')"
               allow-clear
@@ -14,7 +14,7 @@
                 <!-- <Icon icon="ion:search"/> -->
                 <SearchOutlined />
               </template>
-            </a-input>
+            </Input>
             <span :class="`${prefixCls}-cancel`" @click="handleClose">
               {{ t('common.cancelText') }}
             </span>
@@ -76,7 +76,7 @@
 
   export default defineComponent({
     name: 'AppSearchModal',
-    components: { Icon, SearchOutlined, AppSearchFooter, [Input.name]: Input },
+    components: { Icon, SearchOutlined, AppSearchFooter, Input },
     directives: {
       clickOutside,
     },

+ 1 - 1
src/components/CountDown/src/CountButton.vue

@@ -21,7 +21,7 @@
     name: 'CountButton',
     components: { Button },
     props: {
-      value: propTypes.string,
+      value: propTypes.any,
       count: propTypes.number.def(60),
       beforeStartFunc: {
         type: Function as PropType<() => boolean>,

+ 13 - 12
src/components/Cropper/src/index.vue

@@ -57,18 +57,19 @@
         default: '360px',
       },
       crossorigin: {
-        type: String,
+        type: String as PropType<'' | 'anonymous' | 'use-credentials' | undefined>,
         default: undefined,
       },
       imageStyle: {
         type: Object as PropType<CSSProperties>,
-        default: {},
+        default: () => {},
       },
       options: {
         type: Object as PropType<Options>,
-        default: {},
+        default: () => {},
       },
     },
+    emits: ['cropperedInfo'],
     setup(props, ctx) {
       const imgElRef = ref<ElRef<HTMLImageElement>>(null);
       const cropper: any = ref<Nullable<Cropper>>(null);
@@ -109,17 +110,17 @@
       // event: return base64 and width and height information after cropping
       const croppered = (): void => {
         let imgInfo = cropper.value.getData();
-        cropper.value.getCroppedCanvas().toBlob(blob => {
-        let fileReader: FileReader = new FileReader()
+        cropper.value.getCroppedCanvas().toBlob((blob) => {
+          let fileReader: FileReader = new FileReader();
           fileReader.onloadend = (e: any) => {
-            ctx.emit("cropperedInfo", {
+            ctx.emit('cropperedInfo', {
               imgBase64: e.target.result,
-              imgInfo
-            })
-          }
-          fileReader.readAsDataURL(blob)
-        }, 'image/jpeg')
-      }
+              imgInfo,
+            });
+          };
+          fileReader.readAsDataURL(blob);
+        }, 'image/jpeg');
+      };
 
       onMounted(init);
 

+ 3 - 3
src/components/Form/src/components/FormAction.vue

@@ -67,15 +67,15 @@
       showAdvancedButton: propTypes.bool.def(true),
       resetButtonOptions: {
         type: Object as PropType<ButtonOptions>,
-        default: {},
+        default: () => {},
       },
       submitButtonOptions: {
         type: Object as PropType<ButtonOptions>,
-        default: {},
+        default: () => {},
       },
       actionColOptions: {
         type: Object as PropType<Partial<ColEx>>,
-        default: {},
+        default: () => {},
       },
       actionSpan: propTypes.number.def(6),
       isAdvanced: propTypes.bool,

+ 3 - 3
src/components/Form/src/components/FormItem.vue

@@ -28,15 +28,15 @@
       },
       formProps: {
         type: Object as PropType<FormProps>,
-        default: {},
+        default: () => {},
       },
       allDefaultValues: {
         type: Object as PropType<Recordable>,
-        default: {},
+        default: () => {},
       },
       formModel: {
         type: Object as PropType<Recordable>,
-        default: {},
+        default: () => {},
       },
       setFormModel: {
         type: Function as PropType<(key: string, value: any) => void>,

+ 1 - 1
src/components/SimpleMenu/src/SimpleMenuTag.vue

@@ -14,7 +14,7 @@
     props: {
       item: {
         type: Object as PropType<Menu>,
-        default: {},
+        default: () => {},
       },
       dot: propTypes.bool,
       collapseParent: propTypes.bool,

+ 1 - 1
src/components/SimpleMenu/src/SimpleSubMenu.vue

@@ -64,7 +64,7 @@
     props: {
       item: {
         type: Object as PropType<Menu>,
-        default: {},
+        default: () => {},
       },
       parent: propTypes.bool,
       collapsedShowTitle: propTypes.bool,

+ 2 - 2
src/components/SimpleMenu/src/components/Menu.vue

@@ -30,7 +30,7 @@
       activeName: propTypes.oneOfType([propTypes.string, propTypes.number]),
       openNames: {
         type: Array as PropType<string[]>,
-        default: [],
+        default: () => [],
       },
       accordion: propTypes.bool.def(true),
       width: propTypes.string.def('100%'),
@@ -39,7 +39,7 @@
       collapse: propTypes.bool.def(true),
       activeSubMenuNames: {
         type: Array as PropType<(string | number)[]>,
-        default: [],
+        default: () => [],
       },
     },
     emits: ['select', 'open-change'],

+ 1 - 1
src/components/Table/src/components/HeaderCell.vue

@@ -23,7 +23,7 @@
     props: {
       column: {
         type: Object as PropType<BasicColumn>,
-        default: {},
+        default: () => {},
       },
     },
     setup(props) {

+ 1 - 1
src/components/Table/src/components/editable/EditableCell.vue

@@ -60,7 +60,7 @@
       },
       column: {
         type: Object as PropType<BasicColumn>,
-        default: {},
+        default: () => {},
       },
       index: propTypes.number,
     },

+ 1 - 1
src/components/Table/src/components/settings/index.vue

@@ -30,7 +30,7 @@
     props: {
       setting: {
         type: Object as PropType<TableSetting>,
-        default: {},
+        default: () => {},
       },
     },
     setup(props) {

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

@@ -41,7 +41,7 @@
       },
       options: {
         type: Array as PropType<LabelValueOptions>,
-        default: [],
+        default: () => [],
       },
     },
     setup(props) {

+ 2 - 2
src/locales/useLocale.ts

@@ -34,8 +34,8 @@ export function useLocale() {
   const getLocale = computed(() => localeStore.getLocale);
   const getShowLocalePicker = computed(() => localeStore.getShowPicker);
 
-  const getAntdLocale = computed(() => {
-    return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale;
+  const getAntdLocale = computed((): any => {
+    return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale ?? {};
   });
 
   // Switching the language will change the locale of useI18n

+ 26 - 20
src/views/demo/comp/cropper/index.vue

@@ -1,7 +1,12 @@
 <template>
   <PageWrapper title="图片裁剪示例" contentBackground>
     <div class="cropper-container">
-      <CropperImage ref="refCropper" src="https://fengyuanchen.github.io/cropperjs/images/picture.jpg" @cropperedInfo="cropperedInfo" style="width:40%" />
+      <CropperImage
+        ref="refCropper"
+        src="https://fengyuanchen.github.io/cropperjs/images/picture.jpg"
+        @cropperedInfo="cropperedInfo"
+        style="width: 40%"
+      />
       <a-button type="primary" @click="onCropper"> 裁剪 </a-button>
       <img :src="cropperImg" class="croppered" v-if="cropperImg" />
     </div>
@@ -20,41 +25,42 @@
     },
     setup() {
       let vm: any;
-      let info = ref("");
-      let cropperImg = ref("");
+      let info = ref('');
+      let cropperImg = ref('');
 
       const onCropper = (): void => {
         vm.refs.refCropper.croppered();
-      }
+      };
 
-      onBeforeMount(()=>{
+      onBeforeMount(() => {
         vm = getCurrentInstance();
-      })
+      });
 
-     function cropperedInfo({ imgBase64, imgInfo }) {
-       info.value = imgInfo
-       cropperImg.value = imgBase64
-     }
+      function cropperedInfo({ imgBase64, imgInfo }) {
+        info.value = imgInfo;
+        cropperImg.value = imgBase64;
+      }
 
       return {
         img,
         info,
         cropperImg,
         onCropper,
-        cropperedInfo
+        cropperedInfo,
       };
     },
   });
 </script>
 
 <style scoped>
-.cropper-container {
-  display:flex;
-  justify-content: space-around;
-  align-items: center;
-}
-.croppered {
-  width: 50%;
-  height: 100%;
-}
+  .cropper-container {
+    display: flex;
+    justify-content: space-around;
+    align-items: center;
+  }
+
+  .croppered {
+    width: 50%;
+    height: 100%;
+  }
 </style>