Created
April 6, 2021 18:55
-
-
Save CognitiveDave/40307c1e2938501eb145a30c30c99fce to your computer and use it in GitHub Desktop.
semanticScript for vue template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import axios from 'axios' | |
export default { | |
name: 'text', | |
props: { | |
msg: String | |
}, | |
data() { | |
return { | |
queries: ['birds','scatt'], | |
description: 'Tropical birds scattered as Drake veered the Jeep', | |
form: { | |
text: '' | |
}, | |
show: true, | |
payload: {'text': ""} | |
} | |
}, | |
methods: { | |
getKeywords () { | |
this.show = false | |
this.description = this.form.text | |
const path = '/keywords' | |
this.payload.text = this.form.text | |
axios.post(path, this.payload) | |
.then((res) => { | |
this.queries = res.data.keywords | |
this.show = true | |
}) | |
.catch((error) => { | |
// eslint-disable-next-line | |
console.error(error) | |
this.description = "error"; | |
this.show = true; | |
}) | |
}, | |
onReset() { | |
this.form.text = "" | |
this.description = "Tropical birds scattered as Drake veered the Jeep" | |
this.queries = ['birds','scatt'] | |
this.show = false | |
this.$nextTick(() => { | |
this.show = true | |
}) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment