fastlion-amis
Version:
一种MIS页面生成工具
31 lines (28 loc) • 996 B
text/typescript
import { observable, action } from "mobx";
class tableCtxMenuStore {
/** 右键菜单位置 */
position = [0, ''];
/** table的唯一id */
tableId = '';
/** 显示菜单 */
contextMenuVisible = false;
onContextMenuVisibleChange = (visible: boolean) => {
this.contextMenuVisible = visible;
}
updatePosition = (position) => {
this.position = position;
}
updateTableId = (tableId) => {
this.tableId = tableId;
}
/** 触发显示右键菜单 */
showContextMenu = (rowIndex, colName, tableId) => {
const visible = (colName != undefined && colName != 'operation');
/** 更新tableid,给table用做是否显示菜单(防止多表格会同时显示右键菜单) */
this.updateTableId(tableId);
this.updatePosition([rowIndex, colName])
this.onContextMenuVisibleChange(visible);
}
}
const TableCtxMenuStore = new tableCtxMenuStore();
export default TableCtxMenuStore;