[英]use mixins as class names in stylus
我是觸控筆的初學者,並且正在使用vue進行項目創建一個小型組件庫。 我想知道是否可以使用mixins作為類名來實現以下目的:
<style lang="stylus"> // this is where the stylus code is written.
bgColor (argument)
background-color: argument
</style>
然后在HTML模板中將其用作:
<div class="bgColor(ff0000)"></div>
我基本上想要實現的是一種使用手寫筆模擬霧化器( https://acss.io/guides/atomizer.html )的簡單方法。
我也願意以任何其他方式實現這一目標。
提前致謝!
手寫筆是一種預處理器語言,即使在Vue上,它在編譯后也不是動態的。
但是您可以通過生成每個顏色選項作為類來歸檔。
<style lang="stylus">
colors = ( ff0000, ff00ff ) // color collection
for color in colors
.bgColor\({color}\)
background-color unquote('#' + color)
</style>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.