所遇問題:
vue + ts + Element表單驗證報錯Property ‘validate’ does not exist on type Vue。
同時網上大多數博文都是斷言爲any類型。這種做法頗爲敷衍。
解決代碼:
const form = this.$refs.form as ElForm
form.validate((valid: boolean) => {
if (valid) {
this.uploadPlugin()
}
})
所遇問題:
vue + ts + Element表單驗證報錯Property ‘validate’ does not exist on type Vue。
同時網上大多數博文都是斷言爲any類型。這種做法頗爲敷衍。
解決代碼:
const form = this.$refs.form as ElForm
form.validate((valid: boolean) => {
if (valid) {
this.uploadPlugin()
}
})