Nuxt/examples/vue-class-component/components/Base.vue
pooya parsa e7cc2757c3 refactor: update eslint-config to 1.x
Co-authored-by: Alexander Lichter <manniL@gmx.net>
2019-07-10 15:15:49 +04:30

48 lines
748 B
Vue

<template>
<div>
<input v-model="msg">
<p>msg: {{ msg }}</p>
<p>env: {{ env }}</p>
<p>computed msg: {{ computedMsg }}</p>
<button @click="greet">
Greet
</button>
<p>
<NuxtLink to="/about">
About page
</NuxtLink>
</p>
</div>
</template>
<script>
import Vue from 'vue'
import Component from 'nuxt-class-component'
export default
@Component({
props: {
env: String
}
})
class Base extends Vue {
// initial data
msg = 123
// lifecycle hook
mounted () {
this.greet()
}
// computed
get computedMsg () {
return 'computed ' + this.msg
}
// method
greet () {
console.log('base greeting: ' + this.msg) // eslint-disable-line no-console
}
}
</script>