0👍
It seems kind of strange. I conclude you reading it properly on server-side. So I bet your server only wants Number(7) not String(7). You should change basic stance of busqueda to null. Then add .number modifier to v-model. Like that:
<input type="text" class="form-control" v-model.number="busqueda" placeholder="Buscar usuario" />
How to prevent load the page everytime you push button?
Add .prevent modifier.
Change:
<button type="submit" class="btn btn-default" v-on:click="buscarUsuario">Buscar</button>
To:
<button type="submit" class="btn btn-default" v-on:click.prevent="buscarUsuario">Buscar</button>
Also I recomend use @ as shortcut for v-on:(in this example you could have use @click.prevent).
If it still refreshes. Add @submit.prevent=”functionName” to form…
- [Vuejs]-Accessing Vue.$router inside an external "service" class
- [Vuejs]-How can I collapse child items in hover sidebar in Vuetify?
0👍
Use id without quote and click.prevent to prevent submit.
params: {
id: 7
}
<button type="submit" class="btn btn-default" v-on:click.prevent="buscarUsuario">Buscar</button>
also you can use button type=”buttton”
<button type="button" class="btn btn-default" v-on:click="buscarUsuario">Buscar</button>
- [Vuejs]-How to access refs in methods in vuejs
- [Vuejs]-How to get data with axios from all api pages?
Source:stackexchange.com