-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
记一次前端项目重构要点总结 #7
Comments
非常想学习下 想学习下完整的使用方法, 感觉这样写很不错唉 |
@ihoey 的确,这是摸索许久发现的一个简易方法。可以新建目录结构:
model.js
然后在vue或vuex中直接引用 import { libraryApp } from '../models/model'
export default {
...
mounted() { libraryApp.render() }
...
}
... |
还是比较好奇 |
其实它并没有对应vue或vuex的state、getter等,只是一个普通非响应式model对象,参考了vuex的写法,在任何地方都可以引用。如果你要在vuex中使用,直接引入getters或actions使用就行。 |
明白了, 也就是这样的写法其实没有办法直接用在 vuex 对吧 还是要将 getters actions 等单独写,刚开始没有看懂 类vuex 的意思😅😅 |
我之前尝试过一次封装Vuex为这样的写法,但时间有限,发现有很多问题需要解决,不过redux完全可以。你感兴趣也可以试试写一个vuex的。 |
好的 非常感谢 之前没有用过 mobx 我去看下 |
使用Map代替判断更占用内存 |
No description provided.
The text was updated successfully, but these errors were encountered: