|
|
@@ -1,18 +1,18 @@
|
|
|
<template>
|
|
|
- <div @contextmenu.prevent="onContextMenu">
|
|
|
- <a-table
|
|
|
- class="quote-table"
|
|
|
- :columns="columns"
|
|
|
- :data-source="dataSource"
|
|
|
- bordered
|
|
|
- :pagination="false"
|
|
|
- :scroll="{ x: true, y: 600 }">
|
|
|
- <template #action>
|
|
|
- <a>action</a>
|
|
|
- </template>
|
|
|
- </a-table>
|
|
|
- <contextMenu :contextMenu="context" @update="updateContextMenu"/>
|
|
|
- </div>
|
|
|
+ <div @contextmenu.prevent="onContextMenu">
|
|
|
+ <a-table class="quote-table"
|
|
|
+ :columns="columns"
|
|
|
+ :data-source="dataSource"
|
|
|
+ bordered
|
|
|
+ :pagination="false"
|
|
|
+ :scroll="{ x: true, y: 600 }">
|
|
|
+ <template #action>
|
|
|
+ <a>action</a>
|
|
|
+ </template>
|
|
|
+ </a-table>
|
|
|
+ <contextMenu :contextMenu="context"
|
|
|
+ @update="updateContextMenu" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
import { defineComponent, reactive, PropType } from 'vue';
|
|
|
@@ -26,7 +26,7 @@ function handleContextMenu(props: any) {
|
|
|
show: false,
|
|
|
menuList: [],
|
|
|
selectedData: null,
|
|
|
- })
|
|
|
+ });
|
|
|
function onContextMenu(value: MouseEvent) {
|
|
|
const target = value.target as any;
|
|
|
// 获取点击表格的 tr 所在的 索引位置
|
|
|
@@ -34,18 +34,18 @@ function handleContextMenu(props: any) {
|
|
|
const { clientX, clientY } = value;
|
|
|
Object.assign(context.position, { clientX, clientY });
|
|
|
context.show = true;
|
|
|
- context.selectedData = props.dataSource[index]
|
|
|
+ context.selectedData = props.dataSource[index];
|
|
|
}
|
|
|
// 关闭右键弹窗
|
|
|
function updateContextMenu(value: boolean) {
|
|
|
- context.show = value
|
|
|
+ context.show = value;
|
|
|
}
|
|
|
- return { context, onContextMenu, updateContextMenu }
|
|
|
+ return { context, onContextMenu, updateContextMenu };
|
|
|
}
|
|
|
|
|
|
export default defineComponent({
|
|
|
components: {
|
|
|
- contextMenu
|
|
|
+ contextMenu,
|
|
|
},
|
|
|
props: {
|
|
|
columns: {
|
|
|
@@ -59,7 +59,7 @@ export default defineComponent({
|
|
|
contextMenuList: {
|
|
|
default: [],
|
|
|
type: Object as PropType<MenuItem[]>,
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
setup(props) {
|
|
|
const { context, onContextMenu, updateContextMenu } = handleContextMenu(props);
|
|
|
@@ -75,40 +75,13 @@ export default defineComponent({
|
|
|
<style lang="less">
|
|
|
.quote-table {
|
|
|
height: calc(100% - 440px);
|
|
|
- .ant-table td { white-space: nowrap; }
|
|
|
+ .ant-table td {
|
|
|
+ white-space: nowrap;
|
|
|
+ }
|
|
|
.ant-table-thead {
|
|
|
- tr th {
|
|
|
- background: #212629;
|
|
|
- color: #556772;
|
|
|
- font-size: 14px;
|
|
|
- font-family: Adobe Heiti Std;
|
|
|
- }
|
|
|
.ant-table-fixed-columns-in-body {
|
|
|
width: 100px;
|
|
|
}
|
|
|
}
|
|
|
- .ant-table-tbody .ant-table-row-hover td {
|
|
|
- background: #172B56!important;
|
|
|
- }
|
|
|
- .ant-table-fixed {
|
|
|
- width: max-content !important;
|
|
|
- color: #E5E5E5;
|
|
|
- background: #0E0E0F;
|
|
|
- border-top-color: #0E0E0F !important;
|
|
|
- border-left-color: #161a1c !important;
|
|
|
-
|
|
|
- }
|
|
|
- .ant-table-tbody > tr:hover:not(.ant-table-expanded-row):not(.ant-table-row-selected) > td {
|
|
|
- background: #172B56;
|
|
|
- }
|
|
|
- .ant-table-bordered .ant-table-thead > tr > th, .ant-table-bordered .ant-table-tbody > tr > td {
|
|
|
- padding: 0;
|
|
|
- height: 34px;
|
|
|
- line-height: 34px;
|
|
|
- border-color: #161a1c;
|
|
|
- font-family: Adobe Heiti Std;
|
|
|
- font-size: 16px;
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
</style>;
|