Merge remote-tracking branch 'upstream/2.0' into 2.0
This commit is contained in:
commit
67ab89108c
3 changed files with 47 additions and 64 deletions
8
examples/components/test.vue
Normal file
8
examples/components/test.vue
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<template>
|
||||||
|
<div>123</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -1,70 +1,43 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<Table :height="height" border :columns="columns1" :data="data2"></Table>
|
<Table border :context="self" :columns="columns7" :data="data6"></Table>
|
||||||
<Button @click="height=800">change height</Button>
|
<abc></abc>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import abc from '../components/test.vue';
|
||||||
export default {
|
export default {
|
||||||
|
components: { abc },
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
height: 200,
|
self: this,
|
||||||
columns1: [
|
columns7: [
|
||||||
{
|
{
|
||||||
title: '姓名',
|
title: '姓名',
|
||||||
key: 'name'
|
key: 'name',
|
||||||
|
render (row, column, index) {
|
||||||
|
return `<abc></abc>`;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
key: 'age',
|
key: 'age'
|
||||||
filters:[
|
|
||||||
{
|
|
||||||
label: '小学',
|
|
||||||
value: '小学'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '中学',
|
|
||||||
value: '大学'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '中学',
|
|
||||||
value: '中学'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
filterRemote:function(value,key,column){
|
|
||||||
var that = this;
|
|
||||||
this.$Notice.open({title:`正在远程过滤${key}`,desc:value,duration:3,onClose:function(){
|
|
||||||
that.remoteFilter(value,key,column)
|
|
||||||
}})
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '地址',
|
title: '地址',
|
||||||
key: 'address'
|
key: 'address'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
width: 150,
|
||||||
|
align: 'center',
|
||||||
|
render (row, column, index) {
|
||||||
|
return `<i-button type="primary" size="small" @click="show(${index})">查看</i-button> <i-button type="error" size="small" @click="remove(${index})">删除</i-button>`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
data2: [
|
data6: [
|
||||||
{
|
|
||||||
name: '王小明',
|
|
||||||
age: 18,
|
|
||||||
address: '北京市朝阳区芍药居'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '张小刚',
|
|
||||||
age: 25,
|
|
||||||
address: '北京市海淀区西二旗'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '李小红',
|
|
||||||
age: 30,
|
|
||||||
address: '上海市浦东新区世纪大道'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: '周小伟',
|
|
||||||
age: 26,
|
|
||||||
address: '深圳市南山区深南大道'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: '王小明',
|
name: '王小明',
|
||||||
age: 18,
|
age: 18,
|
||||||
|
@ -87,22 +60,16 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
methods:{
|
methods: {
|
||||||
remoteFilter:function(val,age,column){
|
show (index) {
|
||||||
this.data1 = [
|
this.$Modal.info({
|
||||||
{
|
title: '用户信息',
|
||||||
name: '模拟1',
|
content: `姓名:${this.data6[index].name}<br>年龄:${this.data6[index].age}<br>地址:${this.data6[index].address}`
|
||||||
age: 18,
|
})
|
||||||
address: '北京市朝阳区芍药居'
|
},
|
||||||
},
|
remove (index) {
|
||||||
{
|
this.data6.splice(index, 1);
|
||||||
name: '模拟2',
|
|
||||||
age: 25,
|
|
||||||
address: '北京市海淀区西二旗'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,21 @@
|
||||||
});
|
});
|
||||||
const res = Vue.compile(cell.outerHTML);
|
const res = Vue.compile(cell.outerHTML);
|
||||||
// todo 临时解决方案
|
// todo 临时解决方案
|
||||||
|
|
||||||
|
// 获取父组件使用的局部 component
|
||||||
|
const components = {};
|
||||||
|
Object.getOwnPropertyNames($parent.$options.components).forEach(item => {
|
||||||
|
components[item] = $parent.$options.components[item];
|
||||||
|
});
|
||||||
|
|
||||||
const component = new Vue({
|
const component = new Vue({
|
||||||
render: res.render,
|
render: res.render,
|
||||||
staticRenderFns: res.staticRenderFns,
|
staticRenderFns: res.staticRenderFns,
|
||||||
methods: methods,
|
methods: methods,
|
||||||
data () {
|
data () {
|
||||||
return $parent._data;
|
return $parent._data;
|
||||||
}
|
},
|
||||||
|
components: components
|
||||||
});
|
});
|
||||||
component.row = this.row;
|
component.row = this.row;
|
||||||
component.column = this.column;
|
component.column = this.column;
|
||||||
|
|
Loading…
Add table
Reference in a new issue