(求助)将业务模块封装成个class到模板中直接使用的功能需求 #12873
Unanswered
1451544363
asked this question in
Help/Questions
Replies: 2 comments 1 reply
-
模板中使用方法
|
Beta Was this translation helpful? Give feedback.
0 replies
-
const language = new LangUtils() // 这个是普通对象,没有被vue进行响应式代理(所以template中不会响应式更新) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
`
// 封装的ts文件
export class LangUtils {
}
// 模板中
const language = new LangUtils() // 这种会无效
const language = toReactive(new LangUtils()) // 必须这样才行,在class中不是声明了ref类型嘛,为什么要多加个toReactive呢
`
Beta Was this translation helpful? Give feedback.
All reactions