前端小知識:日後重新整理

Model-view-controller(MVC)實現交互的一種設計模式:is a software design pattern for implementing user interfaces on computers.

  • Model

      -數據的處理以及一些邏輯層

  • View

      -any output representation of information,如html,信息的表現形式

  • Controller

     -接受請求,轉發到model或者view



 

 

 

Controller接受request,操作Model(例如一些數據庫中的操作),更新view。總體上分爲三部分。

這種模式有什麼問題呢?前端有一些小小的改動(一些和邏輯層無關的)也需要後端的協作。

所以前端和後端分離,前後端通過數據交流,後端不需要管前端是什麼樣的。React和Angular之類的框架。

React特點:

  1. One-way data flow:數組只能從上往下傳遞。
  2. Virtual DOM:In-memory data structure cache,computes the resulting differences,and then updates the browser's  displayed DOM efficiently。若有一些小改動不需要重新更新整個頁面。
  3. JSX:結合js和html:寫代碼更方便

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章