I try to access router in my typescript class component:
import {Vue} from 'vue-property-decorator'
import Component from 'nuxt-class-component'
import {Getter, Action} from 'vuex-class'
@Component
export default class Login extends Vue {
@Action login
username = ''
password = ''
async submit () {
await this.login({username: this.username, password: this.password})
this.$router.push('/results')
}
}
Unfortunately, I get:
error TS2339: Property '$router' does not exist on type 'Login'.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…