h5 手淘适配

https://github.com/amfe/lib-flexible/tree/master/src

js主要适配页面布局

fontSize 使用dpr适配

使用sass预处理 单独新建一个mixin.scss

通过@minxin 加名称 就可以定义一个Mixins模块,在模块内你可以添加任何你想重复使用的样式。

@mixin font-dpr($font-size){ 
   font-size: $font-size; 
   [data-dpr="2"] & { 
       font-size: $font-size * 2; 
    } 
    [data-dpr="3"] & {
       font-size: $font-size * 3;
    }
}

在vue文件中使用方法

<style lang="scss" scoped>
    @import '../../style/mixin';
    #head_top {
        @include font-dpr(16px);
    }
</style>

 

原文地址:https://www.cnblogs.com/guozongzhang/p/10825606.html