Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

vue定义组件时,可以将专属方法定义到methods之中,但样式呢?也可以类似定义吗?样式是有scoped属性的,但我没有找到定义到Vue.componue的方法.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
3.6k views
Welcome To Ask or Share your Answers For Others

1 Answer

Vue.component('my-component', {
  template: '<div>hello world</div>'
})

上面这样定义组件没法写样式,因为没有东西去编译css。

.vue中能写样式是因为有loader去编译。
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...