Manage placeholder via props.
authorAlexandre Segura <mex.zktk@gmail.com>
Thu, 09 Feb 2017 16:19:24 +0100
changeset 318 33522d51b9dd
parent 317 3cb75bbbb8b2
child 319 bca3e4b1d0f1
Manage placeholder via props.
src_js/iconolab-bundle/src/components/typeahead/Typeahead.vue
src_js/iconolab-bundle/src/components/typeahead/template.html
--- a/src_js/iconolab-bundle/src/components/typeahead/Typeahead.vue	Thu Feb 09 16:18:42 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/typeahead/Typeahead.vue	Thu Feb 09 16:19:24 2017 +0100
@@ -21,11 +21,11 @@
 		}).fail(dfd.reject);
 		return dfd.promise();
 	}
-	
+
 	export default {
 		mixins: [typeahead],
 		components: { 'taglist' : Taglist },
-		
+
 		props: ['tags', 'read-only'],
 
 		mounted() {
@@ -43,15 +43,15 @@
 				datasource: "wikipedia",
 				selectedTags: "[]",
 				items: [],
-				queryParamName: "QueryString"
-
+				queryParamName: "QueryString",
+                placeholder: "..."
 			}
 		},
 
 		methods: {
-			
+
 			setTags(tags, reset) {
-				tags = Array.isArray(tags) ? tags : []; 
+				tags = Array.isArray(tags) ? tags : [];
 				reset = (typeof reset === "boolean") ? reset : false;
 				if (reset) {
 					this.taglist.reset();
@@ -64,7 +64,7 @@
       				this.reset();
       			}
       		},
-      		
+
       		fetch() {
       			if (this.datasource === "wikipedia") {
       				return this.fetchWikiPedia();
@@ -73,7 +73,7 @@
       			else {
       				var request = {};
 					request[this.queryParamName] = this.query;
-					return get(this.src, query);	
+					return get(this.src, query);
       			}
 			},
 
@@ -87,7 +87,7 @@
 				};
 
 				/* make request */
-				var dfd = jQuery.Deferred(); 
+				var dfd = jQuery.Deferred();
 				jQuery.ajax({
 					url: this.src,
 				 	data: request,
@@ -132,13 +132,13 @@
 
       		prepareResponseData (data) {
       			var responseData = (typeof data === 'string') ? JSON.parse(data): data;
-      			
+
       			if(this.datasource === "wikipedia") {
       				responseData = this.prepareWikipediaResponse(responseData);
       			}
 
       			if (Array.isArray(responseData) && !responseData.length) {
-      				this.showAddButton = true;  
+      				this.showAddButton = true;
       			}
       			return responseData;
       		},
@@ -158,4 +158,4 @@
 
 	}
 
-</script> 
\ No newline at end of file
+</script>
--- a/src_js/iconolab-bundle/src/components/typeahead/template.html	Thu Feb 09 16:18:42 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/typeahead/template.html	Thu Feb 09 16:19:24 2017 +0100
@@ -1,8 +1,8 @@
 <div>
   <taglist ref="taglist"></taglist>
   <!-- the input field -->
-  <input v-show="!readOnly" type="text"
-         placeholder="..."
+  <input v-show="!readOnly" type="text" class="form-control"
+         v-bind:placeholder="placeholder"
          autocomplete="off"
          v-model="query"
          v-on:keyup.8="checkQuery"
@@ -21,4 +21,4 @@
     </li>
   </ul>
   <input v-model="selectedTags" name="tags" type="hidden" />
-</div>
\ No newline at end of file
+</div>