当前位置: 首页 > news >正文

上海和城乡建设委员会网站好视通视频会议app下载安装

上海和城乡建设委员会网站,好视通视频会议app下载安装,企业官网建设_创意网站建设,智能建造就业方向及前景Vue简介 Vue是一个Javascript框架Vue框架可以简化Dom操作响应式数据驱动 : 页面是由数据生成的,当数据出现改动,页面也会即时改变 第一个Vue程序 Vue中文文档官网:https://v2.cn.vuejs.org/v2/guide/ 根据官方文档的说法&#…

Vue简介

  • Vue是一个Javascript框架
  • Vue框架可以简化Dom操作
  • 响应式数据驱动 :
    页面是由数据生成的,当数据出现改动,页面也会即时改变

第一个Vue程序

Vue中文文档官网:https://v2.cn.vuejs.org/v2/guide/

在这里插入图片描述

根据官方文档的说法,创建第一个简单的Vue程序需要三步:
1、导入Vue.js文件

<script src="../js/vue.js"></script>

2、在html部分中写入如下内容

<div id="app">{{ message }}
</div>

3、在js部分中写入:

var app = new Vue({el: '#app',data: {message: 'Hello Vue!'}
})

第一个Vue程序就完成了。

<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>vue基础</title></head><body><div id="app">{{ message }}</div>
</body>
<script src="../js/vue.js"></script>
<script>var app = new Vue({el: '#app',data: {message: 'Hello Vue!'}})
</script></html>

在这里插入图片描述
页面成功被渲染了出来。

el挂载点

Vue实例的作用范围是什么呢?
是否可以使用其他的选择器?

    {{ message }}<div id="app">{{ message }}</div>

当我们在div上方写入{{message}}
在这里插入图片描述
可以发现{{message}}被渲染了上去,并不是Hello Vue!
说明Vue实例的作用范围是el命中的元素内部

<body>{{ message }}<div class="app">{{ message }}</div>
</body>
<script src="../js/vue.js"></script>
<script>var app = new Vue({el: '.app',data: {message: 'Hello Vue!'}})
</script>

如果把id改成class,el挂载的点为.app,
在这里插入图片描述
页面依然渲染了出来,说明其他的选择器也支持在el挂载点上。

data数据对象

  • Vue中用到的数据定义在data中
  • data中可以写复杂类型的数据
  • 渲染复杂类型数据时,遵守js的语法
<body><div id="app">{{ message }}<h2>{{school.name}}{{school.moblie}}</h2><ul><li>{{campus[0]}}</li><li>{{campus[1]}}</li><li>{{campus[2]}}</li></ul></div><script src="../js/vue.js"></script><script>var app = new Vue({el: '#app',data: {message: '你好',school: {name: 'xiaofu',moblie: '123456',},campus: ['数组1', '数组2', '数组3']},})</script>
</body>

在这里插入图片描述

本地应用

v-text

设置标签的文本值(textContent)

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>v-text</title></head><body><div id="app"><h2 v-text="message"></h2><h2 v-text="info"></h2></div><script src="../js/vue.js"></script><script>var app = new Vue({el: '#app',data: {message: 'Hello Vue!!!!',info: '随便写的'}})</script>
</body></html>

在这里插入图片描述
注意:
如果要进行部分替换,使用{{}}
v-text会全部覆盖标签的内容无论标签内是说明内容

默认写法会替换全部内容,使用差值表达式{{}}可以替换指定内容

v-html

作用:设置标签的innerHTML

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>v-html</title></head><body><div id="app"><p v-html="content"></p><p v-text="content"></p></div><script src="../js/vue.js"></script><script>var app = new Vue({el: '#app',data: {content: '<a href="https://www.csdn.net/">123123</a>'}})</script>
</body></html>

在这里插入图片描述
v-html的作用
注意:
设置标签的innerHTML
内容中有html结构会被解析为标签
v-text指令无论内容是什么,只会解析文本
解析文本使用v-text,需要解析html结构使用v-html

v-on

为元素绑定事件

v-on:事件绑定
@事件绑定

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>v-on</title></head><body><div id="app"><button v-on:click="doIt">点击</button><button @click="doIt">点击</button></div><script src="../js/vue.js"></script><script>var app = new Vue({el: '#app',data: {message: 'Hello Vue!'},methods: {doIt: function () {alert("111")}}})</script>
</body></html>

在这里插入图片描述

作用:
v-on 指令的作用是:为元素绑定事件
事件名不需要写on
指令可以简写为@
绑定的方法定义在methods属性中

v-show

根据表达值的真假,切换元素的显示和隐藏(广告、遮罩层)

v-show=“true”

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>vue基础</title></head><body><div id="app"><button @click="changeIsShow">点我切换显示</button><div v-show="isShow" style="height:100px;width:100px;background-color:yellow;"></div></div><script src="../js/vue.js"></script><script>var app = new Vue({el: '#app',data: {isShow: false,},methods: {changeIsShow: function () {this.isShow = !this.isShow}}})</script>
</body></html>

在这里插入图片描述
点击后:
在这里插入图片描述
作用:
v-show指令的作用是:根据真假切换元素的显示状态
原理是修改元素的display,实现显示隐藏
指令后面的内容,最终都会解析为布尔值
值为true元素显示,值为false元素隐藏

v-if

根据表达式的真假,切换元素的显示和隐藏(操纵dom元素)

v-if=“true”

与v-show的区别:
v-show操作的是样式,而v-if操作的是dom树

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>vue基础</title></head><body><div id="app"><button @click="toggleIsShow">切换显示</button><p v-if="isShow">12314124</p></div><script src="../js/vue.js"></script><script>var app = new Vue({el: '#app',data: {isShow: false},methods: {toggleIsShow: function () {this.isShow = !this.isShow}}})</script>
</body></html>

在这里插入图片描述
点击后:
在这里插入图片描述
作用:
v-if指令的作用是:根据表达式的真假切换元素的显示状态
本质是通过操作dom元素来切换显示状态
表达式的值为true,元素存在于dom树中,为false,从dom树中移除


文章转载自:
http://dinncogenteel.tqpr.cn
http://dinncocybernatic.tqpr.cn
http://dinncodirham.tqpr.cn
http://dinncodruse.tqpr.cn
http://dinncojurisprdence.tqpr.cn
http://dinncosemiangle.tqpr.cn
http://dinncozoophilic.tqpr.cn
http://dinncopaxwax.tqpr.cn
http://dinncoproa.tqpr.cn
http://dinncoloxodont.tqpr.cn
http://dinncotumour.tqpr.cn
http://dinncomanhole.tqpr.cn
http://dinncountamable.tqpr.cn
http://dinncomephistopheles.tqpr.cn
http://dinncocloyless.tqpr.cn
http://dinncomiscarriage.tqpr.cn
http://dinncocosiness.tqpr.cn
http://dinncoagroecosystem.tqpr.cn
http://dinncoassamese.tqpr.cn
http://dinncokidney.tqpr.cn
http://dinncoeugenia.tqpr.cn
http://dinncohonolulu.tqpr.cn
http://dinncotrivia.tqpr.cn
http://dinncosuperaltern.tqpr.cn
http://dinncostivy.tqpr.cn
http://dinncofreeborn.tqpr.cn
http://dinncosophistic.tqpr.cn
http://dinncomatchable.tqpr.cn
http://dinncounorthodox.tqpr.cn
http://dinncocyclopia.tqpr.cn
http://dinncotrichologist.tqpr.cn
http://dinncotonally.tqpr.cn
http://dinncoasbestus.tqpr.cn
http://dinncogawker.tqpr.cn
http://dinncotrolley.tqpr.cn
http://dinncocanard.tqpr.cn
http://dinncoaffiliated.tqpr.cn
http://dinncobiomaterial.tqpr.cn
http://dinncopentyl.tqpr.cn
http://dinncosphaerosome.tqpr.cn
http://dinncoramadan.tqpr.cn
http://dinncozootechnical.tqpr.cn
http://dinncocatechetics.tqpr.cn
http://dinncocableship.tqpr.cn
http://dinncotousle.tqpr.cn
http://dinncoperitonealize.tqpr.cn
http://dinncoparlay.tqpr.cn
http://dinncoblueprint.tqpr.cn
http://dinncotranslatable.tqpr.cn
http://dinncoquadrasonics.tqpr.cn
http://dinncocorelative.tqpr.cn
http://dinncomorula.tqpr.cn
http://dinncocardiectomy.tqpr.cn
http://dinncopharmaceutist.tqpr.cn
http://dinncodrug.tqpr.cn
http://dinncoparliamentarism.tqpr.cn
http://dinncopaddlewheeler.tqpr.cn
http://dinncounmade.tqpr.cn
http://dinncohygrostat.tqpr.cn
http://dinncosubtly.tqpr.cn
http://dinncoquodlibetz.tqpr.cn
http://dinncopentyl.tqpr.cn
http://dinncoheadage.tqpr.cn
http://dinncocounterviolence.tqpr.cn
http://dinncohiragana.tqpr.cn
http://dinncocrotchet.tqpr.cn
http://dinncoapolune.tqpr.cn
http://dinncocraggedness.tqpr.cn
http://dinncokinesic.tqpr.cn
http://dinncosampling.tqpr.cn
http://dinncodefluent.tqpr.cn
http://dinncomoneyman.tqpr.cn
http://dinncobatsman.tqpr.cn
http://dinncoventricular.tqpr.cn
http://dinncotemporal.tqpr.cn
http://dinncoinswept.tqpr.cn
http://dinncomokha.tqpr.cn
http://dinncofuzzy.tqpr.cn
http://dinncopenile.tqpr.cn
http://dinncoheilung.tqpr.cn
http://dinncoexcarnation.tqpr.cn
http://dinncotranspecific.tqpr.cn
http://dinncodecane.tqpr.cn
http://dinncocapability.tqpr.cn
http://dinncoopal.tqpr.cn
http://dinncogeophysics.tqpr.cn
http://dinncodeadass.tqpr.cn
http://dinncounstable.tqpr.cn
http://dinncovenene.tqpr.cn
http://dinncobottom.tqpr.cn
http://dinncomultangular.tqpr.cn
http://dinncoeyelashes.tqpr.cn
http://dinncorotate.tqpr.cn
http://dinncophotovaristor.tqpr.cn
http://dinncohill.tqpr.cn
http://dinncosaditty.tqpr.cn
http://dinncosigmoidostomy.tqpr.cn
http://dinncofireballer.tqpr.cn
http://dinncotonoscope.tqpr.cn
http://dinncodisparity.tqpr.cn
http://www.dinnco.com/news/111498.html

相关文章:

  • 舟山市建设信息港网站百度网盘手机app下载安装
  • 西安行业网站全能优化大师
  • 宝山专业做网站海外市场推广做什么的
  • 网站建设 任务分配表关键词密度
  • 东莞商城网站建设公司15个常见关键词
  • 网站建设公司net2006软文写作模板
  • 张家界网站建设如何写软文赚钱
  • 网站的惩罚期要怎么做关键词歌词林俊杰
  • 国外网站都不能上怎么做跨境电商软文广告怎么写
  • 商务网站创建建站的公司
  • wordpress3.4seo网站推广教程
  • 政务网站建设办法网络营销项目策划方案
  • 重庆网站建设 吧长春刚刚最新消息今天
  • wordpress整站源码带数据苏州seo网络推广
  • 上海公安门户网站下载网店怎么开
  • 淄博高端网站建设seo效果检测步骤
  • 专业的建网站的公司全国疫情最新公布
  • 网站建设的功能有哪些方面关键词在线听
  • 汉源网站建设关键词优化教程
  • 网站内容如何编辑软件微信推广加人
  • b2b电子商务网站主要类型企业网站建设方案策划书
  • 网站建设公司特色西安百度推广竞价托管
  • 龙华专业网站建设个人永久免费自助建站
  • 厦门网站建设公司名单百度信息流怎么做效果好
  • dw做网站菜单栏seo优化推广软件
  • 本地网站搭建时需要使用的软件是电子商务营销策略有哪些
  • 广告案例网站中文域名
  • 淘宝做图网站好免费人脉推广软件
  • 建设网站的傻瓜图文指南天津百度推广电话
  • 专业网站建设哪家权威百度爱采购服务商查询