vue |
您所在的位置:网站首页 › vue适配大屏幕 › vue |
目录
第一步:安装插件第二步:装好之后在main.js 里引入 lib-flexible第三步: 在vue.config.js 中添加配置第四步:设置flexible.js的宽度根据屏幕大小自动适配, 修改flexible.js 文件,(全局搜索 flexible.js)第五步:设置完成后重新启动项目,查看效果
前期准备: vue 2.0 vue-cli3 脚手架 flexible 插件 自适应插件 px2rem-loader 插件 将px转化为rem postcss-loader postcssgitee仓库地址 https://gitee.com/hanks_s/vue-big-screen.git 点个star⭐️!!! 第一步:安装插件 npm i lib-flexible -S npm i px2rem-loader -D npm install --save-dev postcss-loader postcss 第二步:装好之后在main.js 里引入 lib-flexible import 'lib-flexible'
测试代码 大屏展示 占满全行 占行一半 export default { name: "test", data() { return { name: `test` } }, mounted() { }, methods: {} } .bg{ height: 100vh; width: 100vw; background: #efefef; /*overflow: hidden;*/ } .header{ height: 150px; text-align: center; font-size: 50px; line-height: 150px; } .body{ height: calc(100% - 150px); } .body div{ line-height: 150px; text-align: center; color: #fff; font-weight: bold; } .box-full { width: 1920px; height: 150px; background: red; } .box-half{ width: 920px; height: 150px; background: green; }
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |