File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 5050 }
5151 },
5252 methods: {
53- selectOption ( $event ) {
53+ setParentOption ( ) {
5454 if (! this .parentSelect .multiple ) {
5555 this .parentSelect .selectOption (this .value , this .$refs .item .textContent );
5656 } else {
5757 this .check = ! this .check ;
5858 }
59-
59+ },
60+ selectOption ($event ) {
61+ this .setParentOption ();
6062 this .$emit (' selected' , $event);
6163 }
6264 },
8789
8890 this .parentSelect .multipleOptions [this .index ] = {};
8991 this .parentSelect .options [this .index ] = this ;
92+
93+ if (this .parentSelect .value === this .value ) {
94+ this .setParentOption ();
95+ }
9096 },
9197 beforeDestroy () {
9298 if (this .parentSelect ) {
Original file line number Diff line number Diff line change 4343 },
4444 computed: {
4545 classes () {
46- console .log (this .disabled );
47-
4846 return {
4947 ' md-disabled' : this .disabled
5048 };
129127 this .selectedValue = output .value ;
130128 this .selectedText = output .text ;
131129
132- if (this .parentContainer ) {
133- this .$parent .setValue (output . text );
130+ if (this .selectedText && this . parentContainer ) {
131+ this .parentContainer .setValue (this . selectedText );
134132 }
135133 },
136134 changeValue (value ) {
155153 },
156154 selectOption (value , text ) {
157155 this .selectedText = text;
156+ this .setTextAndValue (value);
158157 this .changeValue (value);
159158 }
160159 },
161160 mounted () {
162161 this .parentContainer = getClosestVueParent (this .$parent , ' md-input-container' );
163162
164- this .setTextAndValue (this .value );
165-
166163 if (this .parentContainer ) {
167164 this .setParentDisabled ();
168165 this .setParentRequired ();
169166 this .setParentPlaceholder ();
170- this .parentContainer .setValue (this .value );
171167 this .parentContainer .hasSelect = true ;
172168 }
169+
170+ this .setTextAndValue (this .value );
173171 },
174172 beforeDestroy () {
175173 if (this .parentContainer ) {
You can’t perform that action at this time.
0 commit comments