关于 @import scss 的问题。

来源:3-13 课程总结

qq_缺南摸了个北_0

2019-08-09 04:29

为什么在 main.js 中导入了 import 'global.scss'之后。

又要在 .vue 文件中单独导入一次??

@import url('global.scss')



写回答 关注

2回答

  • 写代码的马丁呀
    2019-09-13 06:04:15
  • 写代码的马丁呀
    2019-09-13 06:00:43

    因为 global.scss 中定义了公共的方法

    $fontSize: 37.5
    
    @function px2rem($px) 
        @return ($px / $fontSize) + rem
    
    @mixin center()    
        display: flex
        justify-content: center
        align-items: center
    @import "assets/styles/global"
    .menu-bar
      .menu-wrapper
        position: absolute
        bottom: 0
        left: 0
        z-index: 101
        display: flex
        width: 100%
        height: px2rem(48)
        background: white
        box-shadow: 0 px2rem(-8) px2rem(8) rgba(0, 0, 0, .15)
        &.hide-box-shadow
          box-shadow: none
        .icon-wrapper
          flex: 1
          @include center() // 这个方法 
          .icon-progress
            font-size: px2rem(28)
          .icon-bright
            font-size: px2rem(24)  // 这个方法


快速入门Web阅读器开发

带你了解电子书阅读器的工作原理,通过Vue.js快速实现Web阅读器

26198 学习 · 214 问题

查看课程

相似问题