xm-select/docs/mds/ZTEST.md

63 lines
1.2 KiB
Markdown
Raw Normal View History

## 测试
2019-11-22 12:33:17 +00:00
:::demo
```html
<div id="demo1" class="xm-select-demo"></div>
<script>
var demo1 = xmSelect.render({
2019-11-19 12:13:50 +00:00
el: '#demo1',
2019-11-26 07:50:59 +00:00
paging: true,
2019-12-04 10:54:53 +00:00
pageSize: 2,
2019-12-09 12:17:33 +00:00
autoRow: true,
2019-11-19 12:13:50 +00:00
tree: {
2019-12-04 10:54:53 +00:00
strict: false,
show: true,
2019-11-22 12:33:17 +00:00
showFolderIcon: true,
showLine: true,
indent: 20,
2019-12-02 07:10:58 +00:00
expandedKeys: [ -1, -2 ],
lazy: true,
load: function(item, cb){
setTimeout(function(){
if(item.name.endsWith('2')){
return cb([]);
}
cb([
{name: item.name + 1, value: item.value + '1', children: [] },
{name: item.name + 2, value: item.value + '2', children: [] },
])
}, 500)
}
2019-12-02 07:10:58 +00:00
},
model: {
icon: 'show'
2019-11-26 04:20:02 +00:00
},
2019-12-04 10:54:53 +00:00
radio: false,
2019-11-26 04:20:02 +00:00
toolbar: {
show: true
2019-11-19 12:13:50 +00:00
},
height: 'auto',
2019-12-09 12:17:33 +00:00
initValue: [],
on: function(a){
console.log(this)
}.bind('#demo1'),
2019-11-19 12:13:50 +00:00
data(){
return [
{name: '北京市时代峰峻莱克斯顿荆防颗粒受到了开发建设的路口附近', value: -1, children: [
{name: '朝阳区', value: 1, children: []},
2019-12-02 07:10:58 +00:00
{name: '海淀区', value: 2},
{name: '通州区', value: 3},
]},
{name: '河北省', value: -2, children: [
{name: '廊坊市', value: 4},
{name: '石家庄', value: 5},
{name: '邯郸市', value: 6},
2019-11-19 12:13:50 +00:00
]},
]
2019-12-02 07:10:58 +00:00
},
})
2019-11-22 12:33:17 +00:00
</script>
```
:::