[英]using imported sass file with render functions in vue.js
I have abstracted a vue render function into a separate javascript file. 我已经将vue渲染函数抽象到一个单独的javascript文件中。 Now I want to add a sass component style to it.
现在,我想向其添加一个sass组件样式。 My present approach does not work.
我目前的方法行不通。 Is there a way to call scoped sass into a render function or a functional component?
有没有一种方法可以将作用域的sass调用到渲染函数或功能组件中? here is my code:
这是我的代码:
//form.js
import '../../assets/form.scss'
export default {
render(createElement){
return createElement('form',{
class:{
form:true
},
attrs: {
class:'form'
}
}, [
createElement('input',{attrs: {'placeholder':'Enter url'}}),
createElement('button', 'Submit')
])
} } }}
Found out that I have to import form.scss
in the parent component, I could also have done it this same way, for some reason it was not working earlier. 发现我必须在父组件中导入
form.scss
,我也可以以相同的方式完成此操作,由于某种原因,它无法更早地工作。 The attrs
attribute is not required. 不需要
attrs
属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.