脚本宝典收集整理的这篇文章主要介绍了实现一个mvvm,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
最近在团队内做了一次vue原理分享,现场手写了一个乞丐版mvvm,这里记录一下这个mvvm实现的过程。 源码:https://github.com/keller35/mvvm 这个mvvm是基于发布订阅模式实现(也是vue本身的实现原理),最终达到的效果如下: 使用方式也跟vue一样: this.text = ''; }, }, });
最近在团队内做了一次vue原理分享,现场手写了一个乞丐版mvvm,这里记录一下这个mvvm实现的过程。
源码:https://github.com/keller35/mvvm
这个mvvm是基于发布订阅模式实现(也是vue本身的实现原理),最终达到的效果如下:
使用方式也跟vue一样: