02.Vue2.x Vue模版语法

文章目录

Vue模版语法

html 复制代码
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>模版语法</title>
    <script type="text/javascript" src="../js/vue.js"></script>
  </head>
  <body>
    <!-- 
        Vue模版语法有2大类
        1.插值语法:
            功能:用于解析标签体内容
            写法:{{xxx}},xxx会作为表达式去解析,且可以自动读取到data中的属性
        2.指令语法:
            功能:用于解析标签(包括:标签属性、标签内容、绑定事件......)
            举例:v-bind:href="xxxx" 或:href='xxx'
            备注:Vue中有很多的指令都可以简写
     -->
    <div id="root">
      <h2>插值语法</h2>
      <h4>你好{{msg}}</h4>
      <h4>你好{{msg.toUpperCase()}}</h4>
      <hr />
      <h2>指令语法</h2>
      <!-- v-bind: 可以简写为 : -->
      <a :href="url">点我去学习</a>
      <a href="http://www.baidu.com" :x="msg">点我去学习</a>
    </div>
    <script>
      new Vue({
        el: "#root",
        data: {
          msg: "atguigu",
          url: "https://www.baidu.com",
        },
      });
    </script>
  </body>
</html>
相关推荐
Highcharts.js4 小时前
Highcharts 云端渲染的真相:交互式图表与服务器端生成的边界
前端·信息可视化·服务器渲染·highcharts·图表渲染
zhuyan1084 小时前
Linux 系统磁盘爆满导致无法启动修复指南
前端·chrome
编程牛马姐5 小时前
独立站SEO流量增长:提高Google排名的优化方法
前端·javascript·网络
NotFound4865 小时前
实战指南如何实现Java Web 拦截机制:Filter 与 Interceptor 深度分享
java·开发语言·前端
Dontla6 小时前
高基数(High Cardinality)问题介绍(Prometheus、高基数字段、低基数字段)
前端·数据库·prometheus
一 乐7 小时前
医院挂号|基于springboot + vue医院挂号管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·医院挂号管理系统
whuhewei8 小时前
为什么客户端不存在跨域问题
前端·安全
妮妮喔妮8 小时前
supabase的webhook报错
开发语言·前端·javascript
qq_12084093718 小时前
Three.js 大场景分块加载实战:从全量渲染到可视集调度
开发语言·javascript·数码相机
yivifu9 小时前
手搓HTML双行夹批效果
前端·html·html双行夹注