Commit c223ff91 authored by 张伯涛's avatar 张伯涛

pad端分辨率自适应

parent 052fdf2d
...@@ -2,6 +2,7 @@ import Vue from 'vue' ...@@ -2,6 +2,7 @@ import Vue from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import moment from 'moment' import moment from 'moment'
import Element from 'element-ui' import Element from 'element-ui'
import './utils/rem.js' // 自适应分辨率
// import ElementUI from 'element-ui' // import ElementUI from 'element-ui'
// import './styles/element-variables.scss' // import './styles/element-variables.scss'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n // import locale from 'element-ui/lib/locale/lang/en' // lang i18n
......
$color-theme: #f4ac10; $color-theme: #f4ac10;
.user-manage{ .user-manage{
font-size: 18px; font-size: 18px;
.deptTree{
background: #f4f4f4;
height: 100%
}
.placeholder{ .placeholder{
height:14px; height:14px;
background-color: #F4F4F4 background-color: #F4F4F4
......
// rem等比适配配置文件
// 基准大小
const baseSize = 16
// 设置 rem 函数
function setRem() {
// 当前页面屏幕分辨率相对于 1920宽的缩放比例,可根据自己需要修改
const scale = document.documentElement.clientWidth / 1920
// 设置页面根节点字体大小(“Math.min(scale, 2)” 指最高放大比例为2,可根据实际业务需求调整)
// document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + 'px'
// 设置页面根节点字体大小, 字体大小最小为12
const fontSize = (baseSize * Math.min(scale, 2)) > 16 ? (baseSize * Math.min(scale, 2)) : 16
document.documentElement.style.fontSize = fontSize + 'px'
}
// 初始化
setRem()
// 改变窗口大小时重新设置 rem
window.onresize = function() {
setRem()
}
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
</div> </div>
<el-row :gutter="20"> <el-row :gutter="20">
<!--部门数据--> <!--部门数据-->
<el-col :span="4" :xs="24" style="background: #f4f4f4;height: 100%" @click.native="clickBlank"> <el-col :span="4" class="deptTree" @click.native="clickBlank">
<div class="head-container" style="padding: 10px 6px;background: #FFFFFF"> <div class="head-container" style="padding: 10px 6px;background: #FFFFFF">
<el-input <el-input
v-model="deptName" v-model="deptName"
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</div> </div>
</el-col> </el-col>
<!--用户数据--> <!--用户数据-->
<el-col :span="20" :xs="24"> <el-col :span="20" >
<div class="tableTitle">用户管理列表</div> <div class="tableTitle">用户管理列表</div>
<el-table <el-table
v-loading="loading" v-loading="loading"
......
...@@ -21,6 +21,16 @@ const name = defaultSettings.title || 'vue Admin Template' // page title ...@@ -21,6 +21,16 @@ const name = defaultSettings.title || 'vue Admin Template' // page title
// port = 9528 npm run dev OR npm run dev --port = 9528 // port = 9528 npm run dev OR npm run dev --port = 9528
const port = process.env.port || process.env.npm_config_port || 8080 // dev port const port = process.env.port || process.env.npm_config_port || 8080 // dev port
// 引入等比适配插件
const px2rem = require('postcss-px2rem')
// 配置基本大小
const postcss = px2rem({
// 基准大小 baseSize,需要和rem.js中相同
remUnit: 16
})
// All configuration item explanations can be find in https://cli.vuejs.org/config/ // All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = { module.exports = {
/** /**
...@@ -34,6 +44,11 @@ module.exports = { ...@@ -34,6 +44,11 @@ module.exports = {
loaderOptions: { loaderOptions: {
sass: { sass: {
data: '@import "@/styles/variables.scss";' data: '@import "@/styles/variables.scss";'
},
postcss: {
plugins: [
postcss
]
} }
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment