211.0f8a9304.js 1.7 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[211],{540:function(t,e,s){"use strict";s.r(e);var v=s(3),o=Object(v.a)({},(function(){var t=this,e=t._self._c;return e("ContentSlotsDistributor",{attrs:{"slot-key":t.$parent.slotKey}},[e("div",{staticClass:"custom-block tip"},[e("p",{staticClass:"custom-block-title"},[t._v("提示")]),t._v(" "),e("p",[t._v("说明:本章内容是博主的Vue学习笔记,以"),e("a",{attrs:{href:"https://cn.vuejs.org/v2/guide/",target:"_blank",rel:"noopener noreferrer"}},[t._v("官方文档"),e("OutboundLink")],1),t._v("为准。")])]),t._v(" "),e("h1",{attrs:{id:"mvvm模式"}},[e("a",{staticClass:"header-anchor",attrs:{href:"#mvvm模式"}},[t._v("#")]),t._v(" MVVM模式")]),t._v(" "),e("p",[t._v("MVVM模式,"),e("code",[t._v("M")]),t._v("即 model,数据模型;"),e("code",[t._v("V")]),t._v("即 view,视图;"),e("code",[t._v("VM")]),t._v("即 view-model,视图模型。\n"),t._v(" "),e("img",{attrs:{src:"https://cdn.jsdelivr.net/gh/xugaoyi/image_store/blog/20200204123438.png",alt:""}})]),t._v(" "),e("p",[e("strong",[t._v("理解")])]),t._v(" "),e("p",[t._v("首先,数据Model通过Data Bindings把数据绑定在View视图上,")]),t._v(" "),e("p",[t._v("当View视图有交互(有改变)的时候,Dom listeners会自动监听,然后更新数据Model。")]),t._v(" "),e("p",[e("strong",[t._v("Q:什么是MVVM模式?")])]),t._v(" "),e("p",[t._v("A:MVVM模式,第一个M代表数据模型,V代表视图,VM代表视图模型;\n它的实际操作原理是:后台数据通过视图模型来渲染视图,就是页面。当用户在页面上进行操作的时候,\n视图模型会自动监听到用户的操作,从而改变后台数据。")])])}),[],!1,null,null,null);e.default=o.exports}}]);