mirror of
https://gitee.com/xuliangzhan_admin/vxe-table.git
synced 2026-01-21 05:27:57 +08:00
增加参数 menu-config.enabled
This commit is contained in:
@@ -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: '表头的快捷菜单',
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user