Vue3如何在SCSS中使用v-bind
更新時間:2024年03月02日 14:59:39 作者:huanglihui1007
這篇文章主要介紹了Vue3如何在SCSS中使用v-bind,通過template先創(chuàng)建一個通用的頁面結構,本文結合實例代碼給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧
template
先創(chuàng)建一個通用的頁面結構
<template> <div class="v-bubble-bg"></div> </template>
js
在JS中先對需要用的數(shù)據(jù)進行定義:
可以是參數(shù),也可以是data
<script setup> const props = defineProps({ bgColor: { type: String, default: '#000000' }, bgWidth: { type: [Number, String], default: '100%' }, bgHeight: { type: [Number, String], default: '100%' }, color: { type: String, default: 'rgba(255,255,255,.6)' } }) const pdata = reactive({ size: '12px' }) </script>
css
<style lang="scss" scoped> .v-bubble-bg { background-color: v-bind(bgColor); width: v-bind(bgWidth); height: v-bind(bgHeight); overflow: hidden; position: absolute; left: 0; top: 0; font-size:v-bind('pdata.size') } </style>
運行結果
到此這篇關于Vue3 在SCSS中使用v-bind的文章就介紹到這了,更多相關Vue3使用v-bind內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
vue 使用插槽分發(fā)內(nèi)容操作示例【單個插槽、具名插槽、作用域插槽】
這篇文章主要介紹了vue 使用插槽分發(fā)內(nèi)容操作,結合實例形式總結分析了vue.js使用單個插槽、具名插槽、作用域插槽相關操作技巧與注意事項,需要的朋友可以參考下2020-03-03vue 實現(xiàn)axios攔截、頁面跳轉(zhuǎn)和token 驗證
這篇文章主要介紹了vue 實現(xiàn)axios攔截、頁面跳轉(zhuǎn)和token 驗證,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-07-07vue+element-ui集成隨機驗證碼+用戶名+密碼的form表單驗證功能
在登入頁面,我們往往需要通過輸入驗證碼才能進行登入,那我們下面就詳講一下在vue項目中如何配合element-ui實現(xiàn)這個功能,需要的朋友可以參考下2018-08-08