Przeglądaj źródła

Merge pull request #42 from qor5/fix-vautocomplete-selectitem-v2

fix the value of autocomplete when using the remote data
Chenyang 1 rok temu
rodzic
commit
41c81d43fb

Plik diff jest za duży
+ 0 - 0
vuetifyx/vuetifyxjs/dist/vuetifyxjs.umd.min.js


+ 12 - 2
vuetifyx/vuetifyxjs/src/components/Autocomplete.tsx

@@ -119,11 +119,21 @@ export default Vue.extend({
 	created() {
 		this.listItems =  this.$props.items || [];
 		this.value = (this.$attrs.value) as any || [];
-		this.cachedSelectedItems = this.value;
+		if (this.remoteUrl) {
+			this.cachedSelectedItems = this.value;
+			this.listItems =  this.value;
+
+			const vals: any[] = [];
+			this.value.forEach((val: any) => {
+				vals.push(val.value);
+			})
+			this.value = vals as any;
+			this.$attrs.value = vals as any;
+		}
 	},
 
 	mounted() {
-		(this as any).$plaid().fieldValue(this.$props.fieldName, this.$attrs.value);
+		(this as any).$plaid().fieldValue(this.$props.fieldName, this.value);
 	},
 
 	watch: {

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików