
vue3在scss中使用JavaScript定义的变量
vue
vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
项目地址:https://gitcode.com/gh_mirrors/vu/vue

·
简单代码示例:
<script setup lang="ts">
interface IProps {
height?: number;
}
// 默认props赋值
const props = withDefaults(defineProps<IProps>(), {
height: 40,
})
const heightPx = `${props.height}px`
</script>
<template>
<div class="home">
home-1
</div>
</template>
<style lang="scss">
.home {
height: v-bind(heightPx);
}
</style>
1.在<script>标签定义xx变量
2.在<style lang="scss">使用:
v-bind(xx);




vuejs/vue: 是一个用于构建用户界面的 JavaScript 框架,具有简洁的语法和丰富的组件库,可以用于开发单页面应用程序和多页面应用程序。
最近提交(Master分支:6 个月前 )
9e887079
[skip ci] 4 个月前
73486cb5
* chore: fix link broken
Signed-off-by: snoppy <michaleli@foxmail.com>
* Update packages/template-compiler/README.md [skip ci]
---------
Signed-off-by: snoppy <michaleli@foxmail.com>
Co-authored-by: Eduardo San Martin Morote <posva@users.noreply.github.com> 8 个月前
更多推荐
所有评论(0)