Slog10_支配vue框架之模版语法 v-bind

2018-08-24  本文已影响7人  ArthurSlog_
关注微信公众号“ArthurSlog”

生活在99%以上的信息不是真实的世界 生活中99%以上的信息指向了剩下的信息不是真实的


开发环境MacOS(High Sierra 10.13.5)

课前预习

“HTML DOM” is a standard. 

With the "HTML DOM", JavaScript can access and change all the elements of an HTML document.
本篇讲的是 “HTML DOM”, 而 ”DOM“ 指代的范围就比较广了,更多信息请参考w3cschool
<body id="b1"></body> //这里 id 就是 <body> 的 attributes

<div> Hello ArthurSlog</div>  //这里 "Hello ArthurSlog" 就是 <div> 的 values,String格式的值
Attribute Belongs to Description
accept <input> Specifies the types of files that the server accepts (only for type="file")
accept-charset <form> Specifies the character encodings that are to be used for the form submission
... ... ...
Attribute Description
accesskey Specifies a shortcut key to activate/focus an element
class Specifies one or more classnames for an element (refers to a class in a style sheet)
In other words: The "HTML DOM" is a standard for how to get, change, add, or delete HTML elements.
学会用英文去理解,触碰最本质的信息

需要的信息和信息源:

开始编码:

cd ~/Desktop

mkdir node_vue_TemplateSyntax_v-bind_learningload

cd node_vue_TemplateSyntax_v-bind_learningload

npm init

sudo npm install koa koa-static

index.html

<!DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
    <!-- 开发环境版本,包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <title>ArthurSlog</title>
    </head>
    <body>
        <div id="app">
        <button v-bind:disabled="Output">Hello ArthurSlog</button>
        </div>

        <script>
        new Vue({
            el: '#app',
            data: {
                Output: true
            }
        })
        </script>
    </body>
</html>

index.js

const serve = require('koa-static');
const Koa = require('koa');
const app = new Koa();

// $ GET /package.json
app.use(serve('.'));

app.listen(3000);

console.log('listening on port 3000');

cd ~/Desktop/node_vue_TemplateSyntax_v-bind_learningload

node index.js

index.html

<body>
    <div id="app">
    <button v-bind:disabled="Output">Hello ArthurSlog</button>
    </div>

    <script>
    new Vue({
        el: '#app',
        data: {
            Output: true
        }
    })
    </script>
</body>

index.html

<button v-bind:disabled="Output">Hello ArthurSlog</button>

<script>
new Vue({
    el: '#app',
    data: {
        Output: true
    }
})
</script>

index.html

<button v-bind:disabled="Output">Hello ArthurSlog</button>

index.html

<script>
new Vue({
    el: '#app',
    data: {
        Output: true
    }
})
</script>

index.html

<!DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
    <!-- 开发环境版本,包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <title>ArthurSlog</title>
    </head>
    <body>
        <div id="app">
        <button v-bind:disabled="Output">Hello ArthurSlog</button>
        </div>

        <script>
        new Vue({
            el: '#app',
            data: {
                Output: false
            }
        })
        </script>
    </body>
</html>

cd ~/Desktop/node_vue_TemplateSyntax_v-bind_learningload

node index.js


欢迎关注我的微信公众号 ArthurSlog

关注微信公众号“ArthurSlog”

如果你喜欢我的文章 欢迎点赞 留言

谢谢

上一篇 下一篇

猜你喜欢

热点阅读