Giter VIP home page Giter VIP logo

vite3-h5-vue3's Introduction

移动端布局方案

移动端 vant3.x + vue3.x + vite2.x + ts.4.x + REM 布局 + Viewport (VW) 布局的实例运用

在线预览

http://buqiyuan.gitee.io/vite-vue3-h5

提供三个布局方案

1. REM 布局

使用 js 动态设置 html 的 font-size,css 使用 rem 单位,文本大小可选择使用 px

js 设置 viewport 的 scale 以支持高清设备的 1px

可设置页面最大最小宽度

2. VW 布局

css 使用 vw 单位,文本大小可选择使用 px

使用 transform 以支持高清设备的边框 1px(包括圆角),使用 @mixin ./vw/scss/_border.scss

可设置容器固定纵横比,不可设置页面最大最小宽度

3. REM + VW 布局

html 的 font-size 使用 vw 单位,css 使用 rem 单位,文本大小可选择使用 px

使用 transform 以支持高清设备的边框 1px(包括圆角),使用 @mixin ./vw-rem/scss/_border.scss

可设置容器固定纵横比,可设置页面最大最小宽度

使用

  1. yarn dev

  2. 业务代码中样式的调用方式可参考 ./rem/scss/rem.scss./vw/scss/vw.scss./vw-rem/scss/vw-rem.scss 三个文件;可在 html 文件相应位置配置 data-content-max 属性来限制容器最大最小宽

vite3-h5-vue3's People

Contributors

qiudaoermu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.