update Button & Table Cell
Button add custom event @click,you can use @click in i-button now; Table Cell support data from content
This commit is contained in:
parent
2ac208b99d
commit
99d0429e27
4 changed files with 231 additions and 289 deletions
|
@ -52,36 +52,32 @@
|
|||
const template = this.column.render(this.row, this.column, this.index);
|
||||
const cell = document.createElement('div');
|
||||
cell.innerHTML = template;
|
||||
// const _oldParentChildLen = $parent.$children.length;
|
||||
// const _newParentChildLen = $parent.$children.length;
|
||||
// if (_oldParentChildLen !== _newParentChildLen) { // if render normal html node, do not tag
|
||||
// this.uid = $parent.$children[$parent.$children.length - 1]._uid; // tag it, and delete when data or columns update
|
||||
// }
|
||||
|
||||
this.$el.innerHTML = '';
|
||||
let methods = {};
|
||||
Object.keys($parent).forEach(key => {
|
||||
const func = $parent[`${key}`];
|
||||
const func = $parent[key];
|
||||
if (typeof(func) === 'function' && func.name === 'boundFn') {
|
||||
methods[`${key}`] = func;
|
||||
methods[key] = func;
|
||||
}
|
||||
});
|
||||
const res = Vue.compile(cell.outerHTML);
|
||||
// todo 临时解决方案
|
||||
const component = new Vue({
|
||||
render: res.render,
|
||||
staticRenderFns: res.staticRenderFns,
|
||||
methods: methods
|
||||
methods: methods,
|
||||
data () {
|
||||
return $parent._data;
|
||||
}
|
||||
});
|
||||
|
||||
const Cell = component.$mount();
|
||||
this.$refs.cell.appendChild(Cell.$el);
|
||||
}
|
||||
},
|
||||
destroy () {
|
||||
const $parent = this.content;
|
||||
for (let i = 0; i < $parent.$children.length; i++) {
|
||||
if ($parent.$children[i]._uid === this.uid) {
|
||||
$parent.$children[i].$destroy();
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
toggleSelect () {
|
||||
this.$parent.$parent.toggleSelect(this.index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue