فهرست منبع

SimpleTable修改

zhongxiaoyu 1 سال پیش
والد
کامیت
089f094bf2
2فایلهای تغییر یافته به همراه4 افزوده شده و 37 حذف شده
  1. 3 36
      src/components/SimpleTable/index.vue
  2. 1 1
      src/views/realTime/components/FlightView/useFlightInfo.ts

+ 3 - 36
src/components/SimpleTable/index.vue

@@ -4,24 +4,7 @@
     v-bind="tableProps"
     v-el-table-infinite-scroll="scrollOver"
     :data="dealedTableData"
-    @cell-click="(...args:any[]) => { emit('cellClick', ...args) }"
-    @cell-contextmenu="(...args:any[]) => { emit('cellContextmenu', ...args) }"
-    @cell-dblclick="(...args:any[]) => { emit('cellDblclick', ...args) }"
-    @cell-mouse-enter="(...args:any[]) => { emit('cellMouseEnter', ...args) }"
-    @cell-mouse-leave="(...args:any[]) => { emit('cellMouseLeave', ...args) }"
-    @current-change="(...args:any[]) => { emit('currentChange', ...args) }"
-    @expand-change="(...args:any[]) => { emit('expandChange', ...args) }"
-    @filter-change="(...args:any[]) => { emit('filterChange', ...args) }"
-    @header-click="(...args:any[]) => { emit('headerClick', ...args) }"
-    @header-contextmenu="(...args:any[]) => { emit('headerContextmenu', ...args) }"
-    @header-dragend="(...args:any[]) => { emit('headerDragend', ...args) }"
-    @row-click="(...args:any[]) => { emit('rowClick', ...args) }"
-    @row-contextmenu="(...args:any[]) => { emit('rowContextmenu', ...args) }"
-    @row-dblclick="(...args:any[]) => { emit('rowDblclick', ...args) }"
-    @select="(...args:any[]) => { emit('select', ...args) }"
-    @select-all="(...args:any[]) => { emit('selectAll', ...args) }"
-    @selection-change="(...args:any[]) => { emit('selectionChange', ...args) }"
-    @sort-change="(...args:any[]) => { emit('sortChange', ...args) }"
+    
   >
     <el-table-column
       v-if="sequence || customSequence"
@@ -195,6 +178,7 @@ const props = withDefaults(
     tableLayout?: Layout
     flexible?: boolean
     scrollbarAlwaysOn?: boolean
+    // 上面是el-table原生属性,下面是自定义属性
     columnProps?: TableColumnProps<CommonData>
     columns: (CommonTableColumn & TableColumnProps<CommonData>)[]
     sequence?: boolean
@@ -338,25 +322,8 @@ if (props.cacheKeys?.length) {
   })
 }
 
+// 组件的inheritAttrs属性默认为true,此时组件上的属性(包括v-on)会被添加到根元素上
 const emit = defineEmits([
-  'select',
-  'selectAll',
-  'selectionChange',
-  'cellMouseEnter',
-  'cellMouseLeave',
-  'cellClick',
-  'cellDblclick',
-  'cellContextmenu',
-  'rowClick',
-  'rowContextmenu',
-  'rowDblclick',
-  'headerClick',
-  'headerContextmenu',
-  'sortChange',
-  'filterChange',
-  'currentChange',
-  'headerDragend',
-  'expandChange',
   'sortRuleChange',
   'scrollOver',
 ])

+ 1 - 1
src/views/realTime/components/FlightView/useFlightInfo.ts

@@ -233,7 +233,7 @@ export function useFlightInfo(name: string, dataContent: CommonValue[]) {
 
   const computedFlightInfo = computed(() => item => {
     if (['departureAirportZh', 'landingAirportZh'].includes(item.key)) {
-      return airportNameZhMap[flightInfo[item.key.slice(0, -2)]!]
+      return airportNameZhMap[flightInfo[item.key.slice(0, -2)]!] ?? ''
     }
     if (item.getter) {
       return item.getter(flightInfo)