增加参数 menu-config.enabled

This commit is contained in:
xuliangzhan
2020-12-24 12:30:56 +08:00
parent bccefbcbd0
commit 94c99e0f0c
3 changed files with 27 additions and 6 deletions

View File

@@ -1689,6 +1689,15 @@ const apis = [
enum: '',
defVal: '继承 setup.table.menuConfig',
list: [
{
name: 'enabled',
desc: '是否启用',
version: '3.0.19',
type: 'boolean',
enum: '',
defVal: 'true',
list: []
},
{
name: 'header',
desc: '表头的快捷菜单',

View File

@@ -130,14 +130,14 @@ export default {
* 显示快捷菜单
*/
openContextMenu (evnt, type, params) {
const { ctxMenuStore, ctxMenuOpts } = this
const { isCtxMenu, ctxMenuStore, ctxMenuOpts } = this
const config = ctxMenuOpts[type]
const visibleMethod = ctxMenuOpts.visibleMethod
if (config) {
const { options, disabled } = config
if (disabled) {
evnt.preventDefault()
} else if (options && options.length) {
} else if (isCtxMenu && options && options.length) {
params.options = options
this.preventEvent(evnt, 'event.showMenu', params, null, () => {
if (!visibleMethod || visibleMethod(params)) {

View File

@@ -4,6 +4,7 @@ import VXETable from '../../v-x-e-table'
import VxeTableBody from './body'
import vSize from '../../mixins/size'
import { UtilTools, GlobalEvent, createResizeEvent } from '../../tools'
import { isEnableConf } from './util'
import methods from './methods'
/**
@@ -504,7 +505,7 @@ export default {
return footerOpts && footerOpts.options ? footerOpts.options : []
},
isCtxMenu () {
return this.headerCtxMenu.length || this.bodyCtxMenu.length || this.footerCtxMenu.length
return !!((this.contextMenu || this.menuConfig) && isEnableConf(this.ctxMenuOpts) && (this.headerCtxMenu.length || this.bodyCtxMenu.length || this.footerCtxMenu.length))
},
ctxMenuOpts () {
return Object.assign({}, GlobalConfig.table.menuConfig, this.contextMenu, this.menuConfig)
@@ -713,9 +714,20 @@ export default {
}
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
if (this.mouseOpts.area && !this.handleUpdateCellAreas) {
console.error('[vxe-table] This feature requires use the "vxe-table.pro"')
return
if (!this.handleUpdateCellAreas) {
if (this.clipConfig) {
UtilTools.warn('vxe.error.notProp', ['clip-config'])
}
if (this.fnrConfig) {
UtilTools.warn('vxe.error.notProp', ['fnr-config'])
}
if (this.mouseOpts.area) {
UtilTools.error('vxe.error.notProp', ['mouse-config.area'])
return
}
}
if (this.mouseOpts.area && this.mouseOpts.selected) {
UtilTools.error('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected'])
}
if (this.treeConfig && this.mouseOpts.area) {
UtilTools.error('vxe.error.noTree', ['mouse-config.area'])