当前位置:网站首页>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
边栏推荐
- 机器学习理论之(7):核函数 Kernels —— 一种帮助 SVM 实现非线性化决策边界的方式
- About the operation of unit file reading (I)
- 硬核解析Promise对象(这七个必会的常用API和七个关键问题你都了解吗?)
- Hard core parsing promise object (do you know these seven common APIs and seven key questions?)
- ctfshow-web361(SSTI)
- ESP32 LVGL8. 1 - checkbox (checkbox 23)
- 解决:cnpm : 无法加载文件 ...\cnpm.ps1,因为在此系统上禁止运行脚本
- 玻璃体中的硫酸软骨素
- Serial port debugging tools cutecom and minicom
- 14个py小游戏源代码分享第二弹
猜你喜欢
玻璃体中的硫酸软骨素
ctfshow-web362(SSTI)
Introduction to quantexa CDI syneo platform
ESP32 LVGL8. 1 - calendar (calendar 25)
How to restore MySQL database after win10 system is reinstalled (mysql-8.0.26-winx64. Zip)
Druid SQL和Security在美团点评的实践
Promote QT default control to custom control
STM32: LCD显示
Use stm32cube MX / stm32cube ide to generate FatFs code and operate SPI flash
机器学习理论之(7):核函数 Kernels —— 一种帮助 SVM 实现非线性化决策边界的方式
随机推荐
Kettle paoding jieniu Chapter 17 text file output
Spark performance optimization guide
SQL database syntax learning notes
Daily network security certification test questions (April 15, 2022)
STM32: LCD display
Cutting permission of logrotate file
Connection mode of QT signal and slot connect() and the return value of emit
K210 serial communication
Daily CISSP certification common mistakes (April 13, 2022)
Loop path
解决:cnpm : 无法加载文件 ...\cnpm.ps1,因为在此系统上禁止运行脚本
Daily CISSP certification common mistakes (April 19, 2022)
Teach you to quickly rename folder names in a few simple steps
About the operation of unit file reading (I)
Analysez l'objet promise avec le noyau dur (Connaissez - vous les sept API communes obligatoires et les sept questions clés?)
Feign requests the log to be printed uniformly
ESP32 LVGL8. 1 - textarea text area (textarea 26)
Nacos cluster construction and MySQL persistence configuration
Daily CISSP certification common mistakes (April 15, 2022)
C language simulates entering and leaving the stack, first in first out, first in first out, shared memory