Skip to content

Instantly share code, notes, and snippets.

@CognitiveDave
Created April 6, 2021 18:55
Show Gist options
  • Save CognitiveDave/40307c1e2938501eb145a30c30c99fce to your computer and use it in GitHub Desktop.
Save CognitiveDave/40307c1e2938501eb145a30c30c99fce to your computer and use it in GitHub Desktop.
semanticScript for vue template
<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