【发布时间】:2022-01-07 10:46:50
【问题描述】:
我正在使用 ref 来获取一个值,并且我将“Vue”类型上的属性“值”不存在作为错误。
这是我的代码
confirmPasswordRules: [
(v: string ) => !!v || "Password is required",
(v: string ) => (this.$refs.password) && (v === this.$refs.password.value || "Passwords do not match")
],
我使用 console.log 打印出 this.$refs.password.value 所以它确实有一个值。我还尝试了(this.$refs.password as Vue & { password: () => string }).validate()) 来验证价值,但这没有用。我需要进行哪些更改?
【问题讨论】:
标签: typescript vue.js ref