浅析vue中的MVVM实现原理
(编辑:jimmy 日期: 2024/11/29 浏览:3 次 )
现成MVVM
菜单教程
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title> <script src="/UploadFiles/2021-04-02/vue.js">视图影响数据
数据影响视图
项目构架
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> </body> </html> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title> <script src="/UploadFiles/2021-04-02/mvvm.js">mvvm.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> </body> </html> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title> <script src="/UploadFiles/2021-04-02/mvvm.js">mvvm.js
class MVVM { constructor(options) { this.$el = options.el; this.$data = options.data; if (this.$el) { new Compile(this.$el); } } }compile把dom节点,放在内存中操作(到35分钟)
class Compile { constructor(el, vm) { this.el = this.isElementNode(el) "htmlcode">上一篇:微信小程序textarea层级过高的解决方法class Compile { constructor(el, vm) { this.el = this.isElementNode(el) "text-align: center">文本节点
把data中的数据,显示在视图上(到1:16分)
下一篇:JavaScript实现的九种排序算法