someone to help me with this? I want to keep the reactivity of the input and can use it to change the ident property in a reactive way for the query to the api.
and probe with the hooks created and mounted, apart from separating it in called methods from the mounted but it does not let me change the number in the input.
I would think that you could use a watch to manage the property but you would not know how to implement it.
Thanks for your attention.
new Vue({
el: "#app",
data: {
lista: [],
ident: 2
},
mounted() {
this.loadPokes();
},
methods: {
loadPokes() {
axios.get("https://pokeapi.co/api/v2/pokemon/" + this.ident + '/')
.then(response => {
this.lista = response.data
})
}
}
})
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<html>
<head></head>
<body>
<div id="app">
<ul>
<input type="text" name="" value="" v-model="this.ident" @change="loadPokes">
<li v-for="poke in lista" :key="poke.key">{{poke.name}}</li>
</ul>
</div>
</body>
</html>