前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >vue基础

vue基础

作者头像
城市中的游牧民族
发布2019-02-21 10:52:35
4230
发布2019-02-21 10:52:35
举报
文章被收录于专栏:前端真相前端真相

vue文件组件也支持CSS预处理语言,比如scss或者less。如需使用scss,定义lang属性即可:

代码语言:javascript
复制
<style lang="scss" scoped>...</style>

webpack.config中需要加载vue-loader来解析.vue文件(下面配置支持在vue组件中使用scss语法)。

代码语言:javascript
复制
module: {
        rules: [
            {
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {
                        // Since sass-loader (weirdly) has SCSS as its default parse mode, we map
                        // the "scss" and "sass" values for the lang attribute to the right configs here.
                        // other preprocessors should work out of the box, no loader config like this necessary.
                        'scss': 'vue-style-loader!css-loader!sass-loader',
                        'sass': 'vue-style-loader!css-loader!sass-loader?indentedSyntax'
                    }
                    // other vue-loader options go here
                }
            },
            ......
        ]
    },

引用组件时,名称可以自定义,如下,导入时我将child组件命名为c:

代码语言:javascript
复制
import c from './child'
    export default {
        name: "father",
        components:{'child-com':c},
      data(){
          return {text:"this is  father  components"}
      }

}
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018年07月05日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档