zoukankan      html  css  js  c++  java
  • 简述MVC模式

     1 <!DOCTYPE html>
     2 <html lang="zh-CN">
     3 <head>
     4     <meta charset="UTF-8">
     5     <title>MVC</title>
     6 </head>
     7 <body>
     8     <script type="text/javascript">
     9         // 定义三个对象,模拟Model, View, Controller
    10         var M = {}, V = {}, C = {};
    11 
    12         // Model负责数据
    13         M.data = 'This is simple MVC';
    14 
    15         // View负责渲染数据到页面上
    16         V.render = (M) => {
    17             alert(M.data);
    18         }
    19 
    20         // Controller作为Model和View之间的桥梁
    21         C.handleOne = () => {
    22             V.render(M);
    23         }
    24 
    25         // 在加载页面的时候执行controller中的方法来串联整个MVC
    26         window.onload = C.handleOne;
    27     </script>
    28 </body>
    29 </html>
  • 相关阅读:
    HTTP协议
    php目录操作
    PHP有关类的相关知识
    PHP设计模式
    PHP类的继承
    PHP重写
    php类中成员
    php面向对象
    什么是SVN
    ThinkPHP5 初识路由
  • 原文地址:https://www.cnblogs.com/muou2125/p/10314096.html
Copyright © 2011-2022 走看看