zoukankan      html  css  js  c++  java
  • 1vue模板语法

    <body>
        <div id="app1">
            <div>{{msg}}</div>
        </div>
        <script type="text/javascript" src="../vue.js"></script>
        <script type="text/javascript">
            var vm = new Vue({
                el:'#app1',
                data: {
                    msg:'Hello vue'
                }
            })
        </script>
    </body>
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style type="text/css">
            [v-clock] {
            display:none
        }
        </style>
    </head>
    <body>
        <div id="app1">
            <div v-colck>{{msg}}</div>
        </div>
        <script type="text/javascript" src="../vue.js"></script>
        <script type="text/javascript">
            var vm = new Vue({
                el:'#app1',
                data: {
                    msg:'Hello vue'
                }
            })
        </script>
    </body>
    </html>

    上面是v-clock指令,解决插值表达式闪动问题

    下面是v-text

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style type="text/css">
            [v-clock] {
            display:none
        }
        </style>
    </head>
    <body>
        <div id="app1">
            <div v-text="msg"></div>
        </div>
        <script type="text/javascript" src="../vue.js"></script>
        <script type="text/javascript">
            var vm = new Vue({
                el:'#app1',
                data: {
                    msg:'Hello vue'
                }
            })
        </script>
    </body>
    </html>

    v-html解析html的标签

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style type="text/css">
            [v-clock] {
            display:none
        }
        </style>
    </head>
    <body>
        <div id="app1">
            <div v-html="msg1"></div>
        </div>
        <script type="text/javascript" src="../vue.js"></script>
        <script type="text/javascript">
            var vm = new Vue({
                el:'#app1',
                data: {
                    msg1:'<h1>html</h1>'
                }
            })
        </script>
    </body>
    </html>

    v-pre跳过插值表达式的编译,显示原始内容

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <style type="text/css">
            [v-clock] {
            display:none
        }
        </style>
    </head>
    <body>
        <div id="app1">
            <div v-pre=>{{msg1}}</div>
        </div>
        <script type="text/javascript" src="../vue.js"></script>
        <script type="text/javascript">
            var vm = new Vue({
                el:'#app1',
                data: {
                    msg1:'<h1>html</h1>'
                }
            })
        </script>
    </body>
    </html>

    v-once可以提高性能

    v-model 用在input标签中,数据双向绑定

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        
    </head>
    <body>
        <div id="app1">
            <div v-text='msg1'></div>
            <div>
                <input type="text" v-model='msg1'>
            </div>
        </div>
        <script type="text/javascript" src="../vue.js"></script>
        <script type="text/javascript">
            var vm = new Vue({
                el:'#app1',
                data: {
                    msg1:'Hello world'
                }
            })
        </script>
    </body>
    </html>
  • 相关阅读:
    linux中上传文件出现Refused to display 'http://***' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
    1 js中常用的操作
    1 走进并行世界
    18 java I/O 系统
    Spring项目中的数据库加密
    13/14:字符串与类型信息
    使用HttpClient访问接口(Rest接口和普通接口)
    java 队列的使用(转载)
    java锁有哪些类(转)
    J2EE,J2SE,J2ME,JDK,SDK,JRE,JVM区别(转载)
  • 原文地址:https://www.cnblogs.com/gao-chao/p/13397365.html
Copyright © 2011-2022 走看看