当前位置:网站首页>04_理解MVVM
04_理解MVVM
2022-07-17 00:06:00 【id不存在。】
理解MVVM
MVVM模型
1.M:模型(Model):data中的数据
2.V:视图(view):模板代码
3.VM:视图模型(viewModel):vue实例
观察发现:
1.data中所有的属性,最后都出现在vm身上
2.vm身上所有的属性及vuew原型上所有属性,在vue模板中都可以直接使用
<body>
<div id="root">
<h1>学校名称:{
{name}}</h1>
<h1>学校地址:{
{address}}</h1>
<!-- <h1>测试一下1:{
{1+1}}</h1>
<h1>测试一下2:{
{$options}}</h1>
<h1>测试一下3:{
{$emit}}</h1>
<h1>测试一下4:{
{_c}}</h1> -->
</div>
</body>
<script type="text/javascript">
Vue.config.productionTip = false //阻止 vue 在启动时生成生产提示。
const vm = new Vue({
el: '#root',
data: {
name: '尚硅谷',
address: '北京',
}
})
console.log(vm)
</script>边栏推荐
猜你喜欢

网站如何统计访问人数?51LA如何安装使用?

gtest与gmock的安装与使用

Self encapsulated stylized switch card assembly

Uni app wechat official account (4) - address management page

小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId

mock平台的使用说明
![[elementui El date picker date selector, the end time must not be earlier than the start time, and only the date of the specified number of days from the start time can be selected]](/img/73/af7ca3f670ffee18081b9ca6a9ccf6.png)
[elementui El date picker date selector, the end time must not be earlier than the start time, and only the date of the specified number of days from the start time can be selected]

If the website is hacked, what if you jump to other websites through Baidu / Sogou and other search keywords?

MoveIt2——2.MoveIt在RViz中的快速入门

分布式之数据库和缓存双写一致性方案解析(转载)
随机推荐
JS replaces a character in the string, and JS modifies the specified character in the string
v-cloak与v-bind绑定class
2022年暑假ACM热身练习2(总结)
uni scroll-view 下拉刷新
数据库连接池、sequelize实现增删改查等操作
Uni app wechat applet - Mall (3) - Mall Homepage
[elementui El date picker date selector, the end time must not be earlier than the start time, and only the date of the specified number of days from the start time can be selected]
Buuctf [bjdctf2020]ezphp1 detailed explanation
CTF CRYPTO RSA入门刷题
时间戳转化时间
VsCode建立非工程目录下的头文件自动查找
页面布局——三栏布局解决方式
uni-app微信小程序——商城(6)——我的主页
Vue项目部署,清理缓存
Summary of XML external entity injection (xxE target recurrence)
JS get the suffix format of a file name
js获取一个文件名的后缀格式
extern和static的区别
es可选链
C Programming Language(2nd Edition)--读书笔记--1.5.1