saurav77's avatar

How to change Watch function value in vue js as Dynamic ?

Hello,I want to change watch function value as dynamic.

data(){
		return{
		  keywords:null,
		}
},
methods:{
			setKeywords(){
						this.keywords='test';
			}
},
 I want to set val = this.keywords when setKeywords method is triggered.
 watch: {
		 productSearch(val){ 
				 fetch("https://api.npms.io/v2/search?q="+val)
   						 .then(response => response.json())
   						
	}
}
0 likes
0 replies

Please or to participate in this conversation.