Browse Source

Merge pull request #136 from QingWei-Li/next

Table: fix render static data
杨奕 9 năm trước cách đây
mục cha
commit
c545f5a447
3 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 2 0
      CHANGELOG.md
  2. 1 1
      examples/docs/table.md
  3. 7 1
      packages/table/src/table-column.js

+ 2 - 0
CHANGELOG.md

@@ -6,6 +6,8 @@
 
 - 修复 upload 上传的问题,并增加上传成功和失败的钩子函数
 - button 组件增加 `nativeType` 属性,用于组件内 `<button>` 标签的 `type` 属性,默认值为 `'button'
+- 修复 Table 自定义模板中渲染静态数据错误
+- 修复 TimePicker 的 `picker-options` 属性
 
 ### 1.0.0-rc.1
 

+ 1 - 1
examples/docs/table.md

@@ -768,4 +768,4 @@
 | type | 对应列的类型。如果设置了 `selection` 则显示多选框,如果设置了 `index` 则显示该行的索引(从 1 开始计算) | string | selection/index | - |
 | formatter | 用来格式化内容,在 formatter 执行的时候,会传入 row 和 column | function | - | - |
 | show-tooltip-when-overflow | 当过长被隐藏时显示 tooltip | Boolean | - | false |
-| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息,通过 _self 获取当前上下文。此时不需要配置 property 属性  | - | - |
+| inline-template | 指定该属性后可以自定义 column 模板,参考多选的时间列,通过 row 获取行信息,JSX 里通过 _self 获取当前上下文。此时不需要配置 property 属性  | - | - |

+ 7 - 1
packages/table/src/table-column.js

@@ -172,7 +172,13 @@ export default {
         let customRender = _self.$options.render;
 
         renderColumn = function() {
-          return customRender.call(objectAssign(_self, data));
+          data._staticTrees = _self._staticTrees;
+          data.$options = {};
+          data.$options.staticRenderFns = _self.$options.staticRenderFns;
+          data._renderProxy = _self._renderProxy;
+          data._m = _self._m;
+
+          return customRender.call(data);
         };
       };