mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	Search suggestions and box.
This commit is contained in:
		
							parent
							
								
									5cb0916f75
								
							
						
					
					
						commit
						ff89d601f1
					
				
					 1 changed files with 27 additions and 1 deletions
				
			
		
							
								
								
									
										28
									
								
								src/App.vue
									
										
									
									
									
								
							
							
						
						
									
										28
									
								
								src/App.vue
									
										
									
									
									
								
							| 
						 | 
					@ -13,6 +13,15 @@
 | 
				
			||||||
                    >Piped</router-link
 | 
					                    >Piped</router-link
 | 
				
			||||||
                >
 | 
					                >
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
 | 
					            <div class="uk-navbar-center">
 | 
				
			||||||
 | 
					                <input
 | 
				
			||||||
 | 
					                    class="uk-input uk-form-width-large"
 | 
				
			||||||
 | 
					                    type="text"
 | 
				
			||||||
 | 
					                    placeholder="Search"
 | 
				
			||||||
 | 
					                    v-model="searchText"
 | 
				
			||||||
 | 
					                    @keypress="onChange($event)"
 | 
				
			||||||
 | 
					                />
 | 
				
			||||||
 | 
					            </div>
 | 
				
			||||||
            <div class="uk-navbar-right">
 | 
					            <div class="uk-navbar-right">
 | 
				
			||||||
                <ul class="uk-navbar-nav">
 | 
					                <ul class="uk-navbar-nav">
 | 
				
			||||||
                    <li>
 | 
					                    <li>
 | 
				
			||||||
| 
						 | 
					@ -33,9 +42,26 @@
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
 | 
					import Constants from "@/Constants.js";
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
    data() {
 | 
					    data() {
 | 
				
			||||||
        return {};
 | 
					        return {
 | 
				
			||||||
 | 
					            searchText: "",
 | 
				
			||||||
 | 
					            searchSuggestions: []
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    methods: {
 | 
				
			||||||
 | 
					        onChange(e) {
 | 
				
			||||||
 | 
					            fetch(
 | 
				
			||||||
 | 
					                Constants.BASE_URL +
 | 
				
			||||||
 | 
					                    "/suggestions?query=" +
 | 
				
			||||||
 | 
					                    encodeURI(this.searchText + e.key)
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					                .then(resp => resp.json())
 | 
				
			||||||
 | 
					                .then(json => {
 | 
				
			||||||
 | 
					                    this.searchSuggestions = json;
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue