docs(ncform-theme-elementui): Add disableReorder demo for array-tabs

This commit is contained in:
daniel.xiao
2020-12-15 10:50:49 +08:00
committed by Dmitry Nagibin
parent b52330ed9c
commit c86c191de5
2 changed files with 40 additions and 15 deletions
@@ -160,6 +160,29 @@
}
}
},
{
title: {
cn: '[属性] disableReorder: 是否禁止排序',
en: '[ATTR] disableReorder: whether to disable sorting'
},
schema: {
type: 'object',
properties: {
user: {
type: 'array',
items: {
type: 'string'
},
ui: {
widget: 'array-tabs',
widgetConfig: {
disableReorder: true
}
}
}
}
}
},
{
title: {
cn: '[属性] disableCollapse: 是否禁止折叠',
@@ -120,21 +120,23 @@
mounted() {
const vm = this;
const el = this.$el.querySelector(".el-tabs__nav");
const sortTabs = Sortable.create(el, {
animation: 200,
filter: ".el-icon-close",
dragClass: 'dragging',
onEnd(evt) {
const list = vm.schema.value;
const item = list.splice(evt.oldIndex, 1)[0];
list.splice(evt.newIndex, 0, item);
vm.schema.value = [];
vm.$nextTick(() => {
vm.schema.value = list;
vm.activeName = String(evt.newIndex);
});
}
});
if (!this.mergeConfig.disableReorder) {
const sortTabs = Sortable.create(el, {
animation: 200,
filter: ".el-icon-close",
dragClass: 'dragging',
onEnd(evt) {
const list = vm.schema.value;
const item = list.splice(evt.oldIndex, 1)[0];
list.splice(evt.newIndex, 0, item);
vm.schema.value = [];
vm.$nextTick(() => {
vm.schema.value = list;
vm.activeName = String(evt.newIndex);
});
}
});
}
},
methods: {