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>
  • 相关阅读:
    timeit模块
    python中的del
    python的默认参数
    python3中的nonlocal 与 global
    python通俗讲解闭包
    vlc 视频播放器的快捷键
    Python的重要知识点汇总3
    Python的重要知识点汇总2
    Python的重要知识点汇总1
    01玩转数据结构_08_堆和优先队列
  • 原文地址:https://www.cnblogs.com/gao-chao/p/13397365.html
Copyright © 2011-2022 走看看