浏览代码

Fixed error when the column events are undefined

zhixin 3 年之前
父节点
当前提交
f263f8270d
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. 4 0
      src/bootstrap-table.js
  2. 1 0
      src/utils/index.js

+ 4 - 0
src/bootstrap-table.js

@@ -1852,6 +1852,10 @@ class BootstrapTable {
         events = Utils.calculateObjectValue(null, events)
       }
 
+      if (!events) {
+        throw new Error(`Unknown event in the scope: ${_events}`)
+      }
+
       const field = this.header.fields[i]
       let fieldIndex = this.getVisibleFields().indexOf(field)
 

+ 1 - 0
src/utils/index.js

@@ -280,6 +280,7 @@ export default {
     if (
       !func &&
       typeof name === 'string' &&
+      args &&
       this.sprintf(name, ...args)
     ) {
       return this.sprintf(name, ...args)