+ :change-on-select="changeOnSelect"
+ :trigger="trigger">
@@ -74,7 +75,7 @@
renderFormat: {
type: Function,
default (label, selectedData) {
- return label.join('/');
+ return label.join(' / ');
}
}
},
@@ -118,12 +119,46 @@
this.visible = true;
},
updateResult (result) {
- console.log(JSON.stringify(result))
- this.selected = result;
+ this.tmpSelected = result;
+ },
+ updateSelected () {
+ this.$broadcast('on-find-selected', this.value);
}
},
ready () {
+ this.updateSelected();
+ },
+ events: {
+ // lastValue: is click the final val
+ // fromInit: is this emit from update value
+ 'on-result-change' (lastValue, changeOnSelect, fromInit) {
+ if (lastValue || changeOnSelect) {
+ const oldVal = JSON.stringify(this.value);
+ this.selected = this.tmpSelected;
+ let newVal = [];
+ this.selected.forEach((item) => {
+ newVal.push(item.value);
+ });
+ this.value = newVal;
+
+ if (JSON.stringify(this.value) !== oldVal) {
+ this.$emit('on-change', this.value);
+ }
+ }
+ if (lastValue && !fromInit) {
+ this.handleClose();
+ }
+ }
+ },
+ watch: {
+ visible (val) {
+ if (val) {
+ if (this.value.length) {
+ this.updateSelected();
+ }
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/components/cascader/casitem.vue b/src/components/cascader/casitem.vue
index 599b59af..44b1ddb8 100644
--- a/src/components/cascader/casitem.vue
+++ b/src/components/cascader/casitem.vue
@@ -13,7 +13,8 @@
return [
`${this.prefixCls}-menu-item`,
{
- [`${this.prefixCls}-menu-item-active`]: this.tmpItem.value === this.data.value
+ [`${this.prefixCls}-menu-item-active`]: this.tmpItem.value === this.data.value,
+ [`${this.prefixCls}-menu-item-disabled`]: this.data.disabled
}
]
}
diff --git a/src/components/cascader/caspanel.vue b/src/components/cascader/caspanel.vue
index c7816495..45cfea92 100644
--- a/src/components/cascader/caspanel.vue
+++ b/src/components/cascader/caspanel.vue
@@ -7,7 +7,7 @@
:tmp-item="tmpItem"
@click.stop="handleClickItem(item)"
@mouseenter.stop="handleHoverItem(item)">
-