parse search to make it readable

This commit is contained in:
Front 2022-02-26 15:15:30 -05:00
parent a97b2825ad
commit ff3d92b838
1 changed files with 8 additions and 3 deletions

View File

@ -6,7 +6,11 @@
v-model="text"
@input="textChanged"
/>
{{ response }}
<v-list style="min-width: 180px;">
<v-list-item v-for="(item, index) in response" :key="index">
<v-btn text style="width: 100%;" class="info--text">{{ item }}</v-btn>
</v-list-item>
</v-list>
</div>
</template>
@ -15,14 +19,15 @@ export default {
data() {
return {
text: null,
response: null,
response: [],
}
},
methods: {
textChanged() {
this.$youtube.autoComplete(this.text, (res) => {
this.response = res.data;
const data = res.data.replace(/^.*?\(/,'').replace(/\)$/,''); //Format Response
this.response = JSON.parse(data)[1]
});
}
}