欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue?動態(tài)style?拼接寬度問題

 更新時(shí)間:2022年09月23日 09:53:10   作者:趙四_  
這篇文章主要介紹了vue?動態(tài)style?拼接寬度問題,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

vue 動態(tài)style 拼接寬度

大眾用法:

:style=" { width:30px } "

因?yàn)轫?xiàng)目涉及到進(jìn)度條用行內(nèi)樣式 拼接寬度

其中item.progressNum 是后臺返回的數(shù)據(jù),

vue style的用法

Vue中style的用法總結(jié)如下:

v-bind:style  簡寫:style

1.基本用法

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></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.οnlοad=function(){
            new Vue({
                el:'#box',
                data:{
 
                },
                methods:{
                }
            });
        };
    </script> 
</head>
<body>
    <div id="box">
        <strong :style="{color:'red'}">文字...</strong>
    </div>
</body>
</html>

描述:

<strong :style="{color:'red'}">文字...</strong>

其中的red是class的

結(jié)果:

2.采用數(shù)組形式

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></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.οnlοad=function(){
            new Vue({
                el:'#box',
                data:{
                    c:{color:'red'}
                },
                methods:{
                }
            });
        };
    </script>
</head>
<body>
    <div id="box">
        <strong :style="[c]">文字...</strong>
    </div>
</body>
</html>

描述:

采用數(shù)組的形式,設(shè)置變量c,在data中以對象的形式設(shè)置style屬性

結(jié)果:

3.使用數(shù)組的形式,設(shè)置多個(gè)屬性

<!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.οnlοad=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>

描述:

和第二種一樣,可以設(shè)置多個(gè)屬性

結(jié)果:

4.使用設(shè)置一個(gè)變量的方法

<!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.οnlοad=function(){
            new Vue({
                el:'#box',
                data:{
                    a:{
                        color:'red',
                        backgroundColor:'gray'
                    }
                },
                methods:{
                }
            });
        };
    </script>
</head>
<body>
    <div id="box">
        <strong :style="a">文字...</strong>
    </div>
</body>
</html>

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Vue組件簡易模擬實(shí)現(xiàn)購物車

    Vue組件簡易模擬實(shí)現(xiàn)購物車

    這篇文章主要為大家詳細(xì)介紹了Vue組件簡易模擬實(shí)現(xiàn)購物車,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-12-12
  • 關(guān)于axios配置多個(gè)請求地址(打包后可通過配置文件修改)

    關(guān)于axios配置多個(gè)請求地址(打包后可通過配置文件修改)

    這篇文章主要介紹了關(guān)于axios配置多個(gè)請求地址(打包后可通過配置文件修改),具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-09-09
  • Vue使用fabric.js實(shí)現(xiàn)局部截圖與大圖預(yù)覽功能

    Vue使用fabric.js實(shí)現(xiàn)局部截圖與大圖預(yù)覽功能

    這篇文章主要為大家詳細(xì)介紹了Vue如何使用fabric.js實(shí)現(xiàn)局部截圖與el-image-viewer大圖預(yù)覽功能,文中的示例代碼講解詳細(xì),感興趣的可以了解下
    2024-02-02
  • 新版vue-cli模板下本地開發(fā)環(huán)境使用node服務(wù)器跨域的方法

    新版vue-cli模板下本地開發(fā)環(huán)境使用node服務(wù)器跨域的方法

    這篇文章主要介紹了新版vue-cli模板下本地開發(fā)環(huán)境使用node服務(wù)器跨域的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-04-04
  • vue項(xiàng)目打包解決靜態(tài)資源無法加載和路由加載無效(404)問題

    vue項(xiàng)目打包解決靜態(tài)資源無法加載和路由加載無效(404)問題

    這篇文章主要介紹了vue項(xiàng)目打包,解決靜態(tài)資源無法加載和路由加載無效(404)問題,靜態(tài)資源無法使用,那就說明項(xiàng)目打包后,圖片和其他靜態(tài)資源文件相對路徑不對,本文給大家介紹的非常詳細(xì),需要的朋友跟隨小編一起看看吧
    2023-10-10
  • vue實(shí)現(xiàn)一個(gè)炫酷的日歷組件

    vue實(shí)現(xiàn)一個(gè)炫酷的日歷組件

    公司業(yè)務(wù)新開了一個(gè)商家管理微信H5移動端項(xiàng)目,日歷控件是商家管理員查看通過日程來篩選獲取某日用戶的訂單等數(shù)據(jù)。下面小編給大家?guī)砹嘶趘ue實(shí)現(xiàn)一個(gè)炫酷的日歷組件,感興趣的朋友參考下吧
    2018-10-10
  • 使用vue實(shí)現(xiàn)猜謎卡片游戲

    使用vue實(shí)現(xiàn)猜謎卡片游戲

    這篇文章主要為大家詳細(xì)介紹了如何使用vue實(shí)現(xiàn)簡單的猜謎卡片游戲,文中的示例代碼講解詳細(xì),具有一定的學(xué)習(xí)價(jià)值,感興趣的小伙伴可以參考一下
    2023-09-09
  • 第一個(gè)Vue插件從封裝到發(fā)布

    第一個(gè)Vue插件從封裝到發(fā)布

    這篇文章主要為大家詳細(xì)介紹了第一個(gè)Vue插件從封裝到發(fā)布的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-11-11
  • Vue?Router修改query參數(shù)url參數(shù)沒有變化問題及解決

    Vue?Router修改query參數(shù)url參數(shù)沒有變化問題及解決

    這篇文章主要介紹了Vue?Router修改query參數(shù)url參數(shù)沒有變化問題及解決方案,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-09-09
  • element?實(shí)現(xiàn)導(dǎo)航欄收起展開功能及思路

    element?實(shí)現(xiàn)導(dǎo)航欄收起展開功能及思路

    這篇文章主要介紹了element?實(shí)現(xiàn)導(dǎo)航欄收起展開功能,實(shí)現(xiàn)思路先給 el-menu加上 :collapse="isCollapse" 屬性,這個(gè)屬性也是 element 上的一個(gè)參數(shù),意思為是否開啟折疊動畫,在 data 中定義 isCollapse ,用 true 和 false 控制展開與收起,需要的朋友可以參考下
    2023-01-01

最新評論