1_vue learning record

Read this chapter .

Vue each application, we need to achieve by instantiating vue.

This sentence is to say, vue want to use them in html, you create vue object.

This article is mainly read this one Code:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
</head>
<body>
    <div id="vue_det">
        <h1>site : {{site}}</h1>
        <h1>url : {{url}}</h1>
        <h1>{{details()}}</h1>
    </div>
    
    <script type="text/javascript">
        var vm = new Vue({
            el: '#vue_det',
            data: {
                site: "菜鸟教程",
                url: "www.runoob.com",
                alexa: "10000"
            },
            methods: {
                details: function() {
                    return  this.site + " - 学的不仅是技术,更是梦想!";
                }
            }
        })
    </script>
</body>
</html>

The first point

el What does it mean? element of meaning, the meaning of the elements.

The second point

is used to define data attributes, methods are used to define the function of the method.

{{}} It is used to refer to the object properties and methods vue function return values.

to sum up

vue usage, the object is to get hold of them in javascript.

Guess you like

Origin www.cnblogs.com/gnuzsx/p/11964739.html
Recommended