【发布时间】:2017-10-07 08:19:57
【问题描述】:
这个问题是关于 vue.js,它在使用 webpack 配置的样板上运行。
我需要将 sass 变量从组件 father 动态传递给组件 son(为了命名简单)。
在组件father 上,我可以从样式标签访问$color 变量。
我正在使用这个 html 模板调用son 组件:
// father component
<template>
<son></son>
</template>
<style lang='sass' scoped>
@import 'assets/sass/color';
</style>
导入的sass变量,$color需要来自father并改变son的背景
假设儿子只是一个简单的 div。
// son component
<template>
<div></div>
</template>
<style lang=sass scoped>
div {
width: 200px;
height: 200px;
}
</style>
正确的做法是什么?
【问题讨论】:
标签: javascript css sass vue.js