Browse Source

[Pref 0000] 优化lodash的引入逻辑

houzekong 1 tháng trước cách đây
mục cha
commit
18635f0305

+ 5 - 5
src/components/Configurable/detail/CustomTable.vue

@@ -7,7 +7,7 @@
       <div class="table__content_list_row" v-for="(item, index) in data" :key="`svvhbct-${index}`">
         <div v-for="(t, i) in columns" :key="`svvhbctr-${i}`" :style="{ flexBasis }" :class="`table__content__list_item_${type}`">
           <slot :name="t.prop" :scope="item">
-            <span>{{ get(item, t.prop) }}</span>
+            <span>{{ getter(item, t.prop) }}</span>
           </slot>
         </div>
       </div>
@@ -16,7 +16,7 @@
 </template>
 <script lang="ts" setup>
   import { computed } from 'vue';
-  import _ from 'lodash';
+  import { get, isNil } from 'lodash-es';
 
   let props = withDefaults(
     defineProps<{
@@ -40,9 +40,9 @@
     return Math.fround(100 / props.columns.length) + '%';
   });
 
-  function get(o, p) {
-    const d = _.get(o, p);
-    return _.isNil(d) ? props.defaultValue : d === '' ? props.defaultValue : d;
+  function getter(o, p) {
+    const d = get(o, p);
+    return isNil(d) ? props.defaultValue : d === '' ? props.defaultValue : d;
   }
 </script>
 <style lang="less" scoped>

+ 1 - 1
src/components/Form/src/components/FormGroup.vue

@@ -13,7 +13,7 @@
   import { defineComponent, PropType, watch } from 'vue';
   import { Space, Button } from 'ant-design-vue';
   import { useAttrs } from '/@/hooks/core/useAttrs';
-  import { first } from 'lodash';
+  import { first } from 'lodash-es';
 
   export default defineComponent({
     name: 'FormGroup',

+ 1 - 1
src/components/Form/src/jeecg/components/MineCascader/MineCascader.vue

@@ -21,7 +21,7 @@
 </template>
 
 <script lang="ts">
-  import { last } from 'lodash';
+  import { last } from 'lodash-es';
   import { defineComponent, ref, watch } from 'vue';
   // import { useMessage } from '/@/hooks/web/useMessage';
   import { propTypes } from '/@/utils/propTypes';

+ 1 - 1
src/layouts/default/feature/simpleMap.data.ts

@@ -1,4 +1,4 @@
-import { get } from 'lodash';
+import { get } from 'lodash-es';
 import { StatusColorEnum } from '/@/enums/jeecgEnum';
 
 // 默认图层ID

+ 1 - 1
src/views/analysis/common/analysis.ts

@@ -1,5 +1,5 @@
 import { ref } from 'vue';
-import { first } from 'lodash';
+import { first } from 'lodash-es';
 import { getGoafSelectOption } from '../../monitor/sealedMonitor/monitor.api';
 import { useMineDepartmentStore } from '/@/store/modules/mine';
 import { resolveAlarm } from '../warningAnalysis/airLeakStatus/airLeak.api';

+ 1 - 1
src/views/analysis/warningAnalysis/connectAnalysis/hooks/form.ts

@@ -1,7 +1,7 @@
 import { ref } from 'vue';
 import { useRoute } from 'vue-router';
 import { getGoafSelectOption } from '/@/views/monitor/sealedMonitor/monitor.api';
-import { first } from 'lodash';
+import { first } from 'lodash-es';
 import { useMineDepartmentStore } from '/@/store/modules/mine';
 
 export function useInitForm() {

+ 1 - 1
src/views/monitor/sealedMonitor/hooks/form.ts

@@ -1,4 +1,4 @@
-import { first, get, last } from 'lodash';
+import { first, get, last } from 'lodash-es';
 import { ref } from 'vue';
 import { useRoute } from 'vue-router';
 import { getGoafSelectOption } from '../monitor.api';

+ 1 - 1
src/views/system/configurable/index.vue

@@ -41,7 +41,7 @@
   import { BasicModal } from '/@/components/Modal';
   import CodeEditor from '/@/components/CodeEditor/src/CodeEditor.vue';
   import { ModulePresetMap } from './options';
-  import _ from 'lodash';
+  import _ from 'lodash-es';
   /** @ts-ignore-next-line */
   import helpContext from './types?raw';
   import { Config } from './types';