如何学习vue框架?
浏览:688 次

上一篇:库和框架的概念
1.库(lib)代表:jQuery
注意:库中有一系列函数。我们想实现一个函数并调用库中的一些方法
特点:库是一个辅助功能,即开发者说了算
2.框架代表:vue
注意:框架中有一个完整的解决方案它指定了一组规则。要使用框架,您需要根据其规则编写代码。编写完成后,框架将在适当的时候解析代码。
特点:框架说了算
例如:v表示创建的数据
3.图书馆与框架的区别:控制权倒置(谁说了算,谁扮演主角)
图书馆:开发者说了算
框架:框架说了算
从质量角度看:框架>库(框架包含库)
1、 vue简介
1.MVC模式和MVVM模式
(1) MVC模式:后端编码控制视图
M: 模型数据
5: 视图视图
C: 控制控制器
简单的过程是:用户与View交互;控制器时间处理器被触发。控制器从模型请求数据(模型)并将其反馈给视图,视图将数据呈现给用户。
注意:真正处理业务逻辑的是模型层,而不是控制器;控制器仅注册和控制页节点事件
(2) MVVM模式
vue的模式是MVVM模式(数据双向绑定)
M: 模型数据层
5: 视图视图层
VM:ViewModel视图数据层==VM(vue的实例)
视图和模型之间没有直接连接,但它们通过ViewModel进行交互。
ViewModel通过双向数据绑定连接视图层和模型层,视图和模型之间的同步是完全自动的,无需人工干预。因此,开发人员只需要关注业务逻辑,不需要手动操作DOM,也不需要关注数据状态的同步。复杂的数据状态维护完全由MVVM管理。
数据驱动视图的思想是数据是核心(当数据改变时,视图也会改变)
① vue的数据双向绑定是通过Object实现的。defineProperty()数据劫持
② 对象defineProperty(obj,prop,descriptor)添加/修改属性
(参数1:对象;参数2:属性(添加/设置);参数3:属性描述符,对象形式)
对象:定义属性的对象。
属性:要定义或修改的属性的名称或符号。
描述符:要定义或修改的属性描述符。
常量对象1={};
对象defineProperty(对象1,'property1'{
值:42,

可写:false
});
//读/写设置为(可写:false),无法更改
对象1.property1=77;
console.log(object1.property1);
//输出:42
(3) vue的安装
//安装:
非营利组织
//导入:
2、 vue的基本使用
{{}}插值表达式胡子语法
函数:直接读取数据中的数据并将其显示到模板(<>{{}}}<>)
① 可以将表达式{msg+200}{{[1,2,3].join('-')}
② 无法放置语句
③ {{}}不能用于属性
{{消息}}
const vm=新Vue({
el:'#app',
数据:{
消息:“hhha”
}
})
3、 说明
1.v-model(数据的双向绑定)
场景:通常用于表单元素
<;p> {{message}}
<;输入v-model=“message”>;
var app=新Vue({
el:'#app',
数据:{
;消息:'你好,Vue!##39;

}
})
2.v-text/v-html的效果与{{}}相同
V-text不识别标记V-html识别标记
{{msg}}
3.v-bind动态绑定数据(单向m=>v)
语法::Attribute=“数据中的值”
① V-on:事件=“事件功能” ② 语法sugar:@event='event函数' ③ 事件功能 //Html部分4.v-on注册/绑定事件
Template: main
Session:
Session type: db
[unisoft__unisoft] Array ( [permission] => [human_valid] => [passport] => )
Loaded Class:
Zend_Db: /web/unisoft/web.system/Zend/Db.php
Zend_Db_Adapter_Abstract: /web/unisoft/web.system/Zend/Db/Adapter/Abstract.php
Zend_Db_Adapter_Mysqli: /web/unisoft/web.system/Zend/Db/Adapter/Mysqli.php
Zend_Db_Profiler: /web/unisoft/web.system/Zend/Db/Profiler.php
Zend_Db_Statement_Interface: /web/unisoft/web.system/Zend/Db/Statement/Interface.php
Zend_Db_Statement: /web/unisoft/web.system/Zend/Db/Statement.php
Zend_Db_Statement_Mysqli: /web/unisoft/web.system/Zend/Db/Statement/Mysqli.php
Zend_Registry: /web/unisoft/web.system/Zend/Registry.php
Zend_Db_Table_Abstract: /web/unisoft/web.system/Zend/Db/Table/Abstract.php
Zend_Session_Abstract: /web/unisoft/web.system/Zend/Session/Abstract.php
Zend_Session: /web/unisoft/web.system/Zend/Session.php
Zend_Session_SaveHandler_Interface: /web/unisoft/web.system/Zend/Session/SaveHandler/Interface.php
Zend_Session_SaveHandler_DbTable: /web/unisoft/web.system/Zend/Session/SaveHandler/DbTable.php
Zend_Exception: /web/unisoft/web.system/Zend/Exception.php
Zend_Session_Exception: /web/unisoft/web.system/Zend/Session/Exception.php
Zend_Db_Select: /web/unisoft/web.system/Zend/Db/Select.php
Zend_Db_Table_Select: /web/unisoft/web.system/Zend/Db/Table/Select.php
Zend_Db_Expr: /web/unisoft/web.system/Zend/Db/Expr.php
Zend_Db_Table_Rowset_Abstract: /web/unisoft/web.system/Zend/Db/Table/Rowset/Abstract.php
Zend_Db_Table_Rowset: /web/unisoft/web.system/Zend/Db/Table/Rowset.php
Zend_Db_Table_Row_Abstract: /web/unisoft/web.system/Zend/Db/Table/Row/Abstract.php
Zend_Db_Table_Row: /web/unisoft/web.system/Zend/Db/Table/Row.php
HTTP: /web/unisoft/web.system/class/cls_http.inc.php
Zend_Session_Namespace: /web/unisoft/web.system/Zend/Session/Namespace.php
system_setting_class: /web/unisoft/web.core/system/setting.php
Zend_Cache: /web/unisoft/web.system/Zend/Cache.php
Zend_Cache_Backend: /web/unisoft/web.system/Zend/Cache/Backend.php
Zend_Cache_Backend_Interface: /web/unisoft/web.system/Zend/Cache/Backend/Interface.php
Zend_Cache_Backend_ExtendedInterface: /web/unisoft/web.system/Zend/Cache/Backend/ExtendedInterface.php
site_ip_class: /web/unisoft/web.core/site/ip.php
Zend_Validate_Interface: /web/unisoft/web.system/Zend/Validate/Interface.php
Zend_Validate: /web/unisoft/web.system/Zend/Validate.php
Zend_Loader: /web/unisoft/web.system/Zend/Loader.php
Zend_Validate_Abstract: /web/unisoft/web.system/Zend/Validate/Abstract.php
TPL: /web/unisoft/web.system/class/cls_template.inc.php
Savant3_Error: /web/unisoft/web.system/Savant3/Error.php
package_main_class: /web/unisoft/web.core/package/main.php
iot_hardware_main_class: /web/unisoft/web.core/iot/hardware/main.php
iot_hardware_category_class: /web/unisoft/web.core/iot/hardware/category.php
site_service_main_class: /web/unisoft/web.core/site/service/main.php
site_article_main_class: /web/unisoft/web.core/site/article/main.php
site_article_extra_class: /web/unisoft/web.core/site/article/extra.php
site_keyword_exclude_class: /web/unisoft/web.core/site/keyword/exclude.php
system_content_class: /web/unisoft/web.core/system/content.php
site_article_attachment_class: /web/unisoft/web.core/site/article/attachment.php
site_article_category_class: /web/unisoft/web.core/site/article/category.php
Database [main master]
[ Log time: 1788138617.7526 ] [ Expend time: 0.0044839382171631 ] Connect DB
Cache
[ Log time: 1788138617.7651 ] Backend:
[ Log time: 1788138617.766 ] [ Expend time: 0.000834 ] Get Cache: settings_ef8c7cef1f80fbad45b9ee480e92d03c, result type: array
[ Log time: 1788138617.7663 ] [ Expend time: 0.000238 ] Get Cache: crond, result type: boolean
[ Log time: 1788138617.7788 ] [ Expend time: 0.000648 ] Get Cache: model_7ec70ee0360b8a929eb442cbc38dfd27, result type: array
[ Log time: 1788138617.7822 ] [ Expend time: 0.002681 ] Get Cache: model_eebc36c56f6ebd5dc315368f04ea4f0d, result type: array
[ Log time: 1788138617.7835 ] [ Expend time: 0.000523 ] Get Cache: model_87644abf3b1d496cbf4b1667422d7d51, result type: array
[ Log time: 1788138617.785 ] [ Expend time: 0.000674 ] Get Cache: site_service_list_7e49c82f3098f580fb5928807f5e466d, result type: array
[ Log time: 1788138617.7945 ] [ Expend time: 0.001631 ] Get Cache: site_keyword_exclude_b2c64c08a5048d87cc4904022274c118, result type: array
[ Log time: 1788138617.8121 ] [ Expend time: 0.001734 ] Get Cache: site_keyword_exclude_b2c64c08a5048d87cc4904022274c118, result type: array
[ Log time: 1788138617.8173 ] [ Expend time: 0.001598 ] Get Cache: site_keyword_exclude_b2c64c08a5048d87cc4904022274c118, result type: array
[ Log time: 1788138617.8374 ] [ Expend time: 0.001652 ] Get Cache: site_keyword_exclude_b2c64c08a5048d87cc4904022274c118, result type: array
[ Log time: 1788138617.8483 ] [ Expend time: 0.000331 ] Get Cache: 151942cd2569c1f9c5f1116e1b0e76a9, result type: boolean
[ Log time: 1788138617.8514 ] [ Expend time: 0.001350 ] Save Cache: 151942cd2569c1f9c5f1116e1b0e76a9, result type: integer
Database [core master]
[ Log time: 1788138617.7698 ] [ Expend time: 0.0016489028930664 ] Connect DB
[ Log time: 1788138617.7707 ] [ Expend time: 0.00070691108703613 ] SELECT `z_ip`.* FROM `z_ip` WHERE (ip = '216.73.216' AND visit_time = 1788138600) LIMIT 1
[ Log time: 1788138617.7724 ] [ Expend time: 0.001694917678833 ] UPDATE z_ip SET visit_count = visit_count + 1 WHERE ip = '216.73.216' and visit_time = 1788138600
[ Log time: 1788138617.7733 ] [ Expend time: 0.0008549690246582 ] DELETE FROM z_ip WHERE visit_count < 120 and visit_time <= 1788138420
[ Log time: 1788138617.7742 ] [ Expend time: 0.00068402290344238 ] SELECT SUM(visit_count) AS `n0` FROM `z_ip` WHERE ((ip = '216.73.216') AND is_delete = 0)
[ Log time: 1788138617.7904 ] [ Expend time: 0.0034360885620117 ] SELECT `z_article`.* FROM `z_article` WHERE (no = '32b4420e026dd3fd') LIMIT 1
[ Log time: 1788138617.7922 ] [ Expend time: 0.0010030269622803 ] SELECT `z_article_extra`.* FROM `z_article_extra` WHERE (is_delete = 0 AND article_id IN(6754))
[ Log time: 1788138617.8156 ] [ Expend time: 0.00083112716674805 ] SELECT `z_article_extra`.* FROM `z_article_extra` WHERE (article_id = 6754) LIMIT 1
[ Log time: 1788138617.8335 ] [ Expend time: 0.001121997833252 ] SELECT `z_article_attachment`.* FROM `z_article_attachment` WHERE (article_id = 6754 AND is_delete = 0) ORDER BY `id` DESC
[ Log time: 1788138617.8357 ] [ Expend time: 0.0020158290863037 ] SELECT `z_article`.* FROM `z_article` WHERE (is_delete = 0 AND category_id = 72 AND is_enable = 1) ORDER BY `id` DESC LIMIT 5
[ Log time: 1788138617.85 ] [ Expend time: 0.0017070770263672 ] UPDATE z_article SET view_count = view_count + 1 WHERE id = 6754
[ Log time: 1788138617.853 ] [ Expend time: 0.00078797340393066 ] SELECT `z_article_category`.* FROM `z_article_category` WHERE (id = 72) LIMIT 1
[ Log time: 1788138617.8538 ] [ Expend time: 0.00064706802368164 ] SELECT `z_article_category`.* FROM `z_article_category` WHERE (id = 30) LIMIT 1
Escape time: 0.11795592308044, 0 queries, PHP Memory usage: 5600.2421875 KB, Server time: 2026-08-31 09:10:17
