vue指令之v-bind
发布日期:2021-05-07 01:02:11 浏览次数:26 分类:原创文章

本文共 889 字,大约阅读时间需要 2 分钟。

main.js:

var app = new Vue({    el: '#app' ,    data: {        url: 'http://www.baidu.com',        img: 'https://img-ads.csdn.net/2018/201802111410487231.png',        isActive: true,        isYellow: true,        isBlue: true    }});

index.html:

<!DOCTYPE html><html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"><head>    <meta charset="UTF-8">    <title>Title</title>    <style>        .active{            background:#FF0000;        }        .yellow{            background:#00FF00;        }        .blue{            background: #0000FF;        }    </style></head><body><div id="app">    <p><a v-bind:href="url">点我</a></p>    <p><img v-bind:src="img"/></p>    <P v-bind:class="{active:isActive}">颜色</P>    <p v-bind:class="{yellow: isYellow}">绿色</p>    <p :class="{blue: isBlue}">蓝色</p></div><script src="../lib/vue.js"></script><script src="./js/main.js"></script></body></html>

上一篇:[CF919E]Congruence Equation
下一篇:The hat

发表评论

最新留言

感谢大佬
[***.8.128.20]2025年04月02日 20时08分22秒