当前位置:网站首页>MVVM model
MVVM model
2022-04-23 18:40:00 【_ ocean】
List of articles
meaning
- M: Model (Model) : Corresponding data Data in
- V: View (View): Templates , Corresponding to the page
- VM: Model view (ViewModel) : Vue Instance object

ViewModel abbreviation vm, It also corresponds to vue, therefore vue Objects created often use variable names vm receive .
eg:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<script src="../js/vue.js"></script>
</head>
<body>
<div id="root">
<h1> School name :{
{name}}</h1>
<h1> School address :{
{address}}</h1>
</div>
</body>
<script> Vue.config.productionTip = false; new Vue({
el:'#root', data:{
name:' Baidu ', address:' Beijing ' } }) </script>
</html>
analysis :

characteristic
1.data All the attributes in , Finally, it all appeared in vm On the body .—— Data brokers
eg:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<script src="../js/vue.js"></script>
</head>
<body>
<div id="root">
<h1> School name :{
{name}}</h1>
<h1> School address :{
{address}}</h1>
</div>
</body>
<script> Vue.config.productionTip = false; const vm = new Vue({
el:'#root', data:{
name:' Baidu ', address:' Beijing ' } }) console.log(vm); </script>
</html>

2.vm All the attributes and Vue All properties on the prototype , stay Vue Templates can be used directly .
eg:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<script src="../js/vue.js"></script>
</head>
<body>
<div id="root">
<h1> School name :{
{name}}</h1>
<h1> School address :{
{address}}</h1>
<h1> monitor :{
{$listeners}}</h1>
<h1>_hasHookEvent:{
{_hasHookEvent}}</h1>
</div>
</body>
<script> Vue.config.productionTip = false; const vm = new Vue({
el:'#root', data:{
name:' Baidu ', address:' Beijing ' } }) console.log(vm); </script>
</html>
Output :

版权声明
本文为[_ ocean]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231835268858.html
边栏推荐
- Spark performance optimization guide
- SQL中函数 decode()与 replace()的用法
- CISSP certified daily knowledge points (April 15, 2022)
- ESP32 LVGL8. 1. Detailed migration tutorial of m5stack + lvgl + IDF (27)
- Daily network security certification test questions (April 14, 2022)
- Nacos作为服务配置中心实战
- CISSP certified daily knowledge points (April 14, 2022)
- Halo open source project learning (VII): caching mechanism
- CANopen STM32 transplantation
- Const keyword, variable and function are decorated with const
猜你喜欢

iptables初探

玻璃体中的硫酸软骨素

硬核解析Promise對象(這七個必會的常用API和七個關鍵問題你都了解嗎?)

ESP32 LVGL8. 1 - arc (arc 19)

Function recursion and solving interesting problems

Machine learning practice - naive Bayes

ESP32 LVGL8. 1 - textarea text area (textarea 26)

Creation and use of QT dynamic link library

Teach you to quickly rename folder names in a few simple steps

Stm32mp157 wm8960 audio driver debugging notes
随机推荐
Sentinel规则持久化进Nacos
Chondroitin sulfate in vitreous
[popular science] CRC verification (I) what is CRC verification?
Machine learning theory (8): model integration ensemble learning
CANopen usage method and main parameters of object dictionary
Halo open source project learning (VII): caching mechanism
Cygwin64 right click to add menu, and open cygwin64 here
ESP32 LVGL8. 1 - img picture (IMG 20)
14个py小游戏源代码分享第二弹
ESP32 LVGL8. 1 - roller rolling (roller 24)
Daily network security certification test questions (April 12, 2022)
MVVM模型
STM32: LCD display
CISSP certified daily knowledge points (April 15, 2022)
Daily CISSP certification common mistakes (April 11, 2022)
22年字节跳动飞书人力套件三面面经
七、DOM(下) - 章节课后练习题及答案
机器学习理论之(8):模型集成 Ensemble Learning
Ionic instruction set order from creation to packaging
机器学习理论之(7):核函数 Kernels —— 一种帮助 SVM 实现非线性化决策边界的方式