vue4 属性 class style
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- url:'https://www.baidu.com/img/bd_logo1.png',
- w:'200px',
- t:'这是一张美丽的图片'
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box">
- <!--<img src="{{url}}" alt=""> 这种方式会报404错 --> 属性是通过bind来绑定的
- <img v-bind:src="url" alt="">
- <img :src="url" alt="">
- <img :src="url" alt="" :width="w" :title="t">
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- red:'red', //是style的red
- b:'blue'
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box"> //red是data里面的red,多个
- <strong :class="[red,b]">文字...</strong>
- <strong :class="red">文字...</strong> //单个data里面的red
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box"> //不是data里的red,是style的red,true表示生肖,
- <strong :class="{red:true,blue:true}">文字...</strong>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- a:true,
- b:false
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box">//不是data里的red,是style的red,true表示生肖,
- <strong :class="{red:a,blue:b}">文字...</strong>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- json:{
- red:true,
- blue:true
- }
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box">
- <strong :class="json">文字...</strong>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box">
- <strong :style="{color:'red'}">文字...</strong>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- c:{color:'red'}
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box">
- <strong :style="[c]">文字...</strong>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- c:{color:'red'},
- b:{backgroundColor:'blue'}
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box">
- <strong :style="[c,b]">文字...</strong>
- </div>
- </body>
- </html>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>智能社——http://www.zhinengshe.com</title>
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <style>
- .red{
- color: red;
- }
- .blue{
- background: blue;
- }
- </style>
- <script src="vue.js"></script>
- <script>
- window.onload=function(){
- new Vue({
- el:'#box',
- data:{
- a:{
- color:'red',
- backgroundColor:'gray' //js里面的驼峰写法
- }
- },
- methods:{
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="box">
- <strong :style="a">文字...</strong>
- </div>
- </body>
- </html>
vue4 属性 class style的更多相关文章
- td的cellIndex属性被style.display改变
IE7下面td的cellIndex属性,居然会随着style.display='none'的设置而改变,真是太恶心了
- Vue入门---属性、style和class绑定方法
一 .用对象的方法绑定class <!DOCTYPE html> <html> <head> <meta charset="UTF-8"& ...
- CSS style 属性
CSS style 属性 定义和用法 必需的 type 属性规定样式表的 MIME 类型. type 属性指示 <style> 与 </style> 标签之间的内容. 值 &q ...
- js外部样式和style属性的添加移除
在页面中,往往一个控件的外部样式或者内部样式往往不只一个,而我们只需操作其中一个样式该怎么办呢? 最开始我也不知道该怎么做,就用了最原始的方法,替换原有的样式为新的样式,这样每次都要获取原样式,找通用 ...
- js_给元素增加或移除style属性
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 前端vue之属性指令、style和class、条件渲染、列表渲染、事件处理、数据双向绑定、表单控制、v-model进阶
今日内容概要 属性指令 style和class 条件渲染 列表渲染 事件处理 数据的双向绑定 v-model进阶 购物车案例 内容详细 1.属性指令 <!DOCTYPE html> < ...
- CSS float 浮动属性
本篇主要介绍float属性:定义元素朝哪个方向浮动. 目录: 1. 页面布局方式:介绍文档流.浮动层以及float属性. 2. float:left :介绍float为 left 时的布局方式. 3. ...
- WPF整理-Style
"Consistency in a user interface is an important trait; there are many facets of consistency, ...
- JS Div滚动,下拉框添加属性,年月日下拉条
创建某一下拉菜单的项: str = str+"<option value='"+i+"'>"+i+"</option>&quo ...
随机推荐
- NOIp2018模拟赛四十五~??
欠的太多,咕了咕了 最近复赛临近时间紧,就不每次都写感想和题解了,只写点有意义的好题
- ubuntu安装和使用
1.查看ubuntu是32位还是64位 教程:jingyan.baidu.com/article/db55b609ab531f4ba30a2f13.html 2.安装maven 教程:www.linu ...
- python学习笔记:第四天
day04: 一.计算求值 num += 1 等价于 num = num + 1num -= 1 等价于 num = num - 1num *= 2 等价于 num = num * 2num /= 2 ...
- CentOS6.3从光盘安装gcc(更改yum源)[转]
转自:http://www.linuxidc.com/Linux/2012-11/73826.htm 一.加载光盘镜像 加载本地bin-DVD镜像文件到虚拟机系统,如图所示: 二.更改yum源 1.挂 ...
- HDU 3108 Ant Trip
Ant Trip Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
- 严重: 文档无效: 找不到语法。 at (null:2:19)
1.错误描写叙述 严重: 文档无效: 找不到语法. at (null:2:19) org.xml.sax.SAXParseException; systemId: file:/D:/MyEclipse ...
- 拥抱PBO(基于项目的组织)聚焦核心价值创造
近年来.PBO(Project-Based Organizations)作为一种新兴的整合各类专业智力资源和专业知识的组织结构,受到越来越多的关注,第五版PMBOK出现的新词汇.三种组织(职能型.矩阵 ...
- opecv2 MeanShift 使用均值漂移算法查找物体
#if !defined OFINDER #define OFINDER #include <opencv2\core\core.hpp> #include <opencv2\img ...
- Leaflet--建设移动设备友好的互动地图
Leaflet 是一个为建设移动设备友好的互动地图,而开发的现代的.开源的 JavaScript 库.它是由 Vladimir Agafonkin 带领一个专业贡献者团队开发,尽管代码仅有 33 KB ...
- Struts2国际化-getText()方法
转自https://blog.csdn.net/qq_43560838/article/details/83747604 一:简单理解 国际化简称i18n,其来源是英文单词 international ...