Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build之后样式不对 #6

Open
luckxiang opened this issue Aug 31, 2018 · 3 comments
Open

npm run build之后样式不对 #6

luckxiang opened this issue Aug 31, 2018 · 3 comments

Comments

@luckxiang
Copy link

luckxiang commented Aug 31, 2018

build打包之后样式比npm run dev调试的时候样式大一些,字体也会大一两号,请问有人遇到过这种情况吗?不知道是本地环境问题还是项目配置本身有问题

@luckxiang
Copy link
Author

luckxiang commented Sep 1, 2018

问题我自己处理了,主要是屏幕分辨率适配的问题,main.js引入代码如下:

var devInnerHeight = 1080.0 // 开发时的InnerHeight
var devDevicePixelRatio = 1.0// 开发时的devicepixelratio
var devScaleFactor = 1.3 // 开发时的ScaleFactor
var scaleFactor = require('electron').screen.getPrimaryDisplay().scaleFactor
var zoomFactor = (window.innerHeight / devInnerHeight) * (window.devicePixelRatio / devDevicePixelRatio) * (devScaleFactor / scaleFactor)
require('electron').webFrame.setZoomFactor(zoomFactor)

具体可以见我博客
electron-vue打包后样式变大以及不同分辨率屏幕适配问题

@WildLight
Copy link

请问能发一下完整的解决方法么

@luckxiang
Copy link
Author

sorry,前面域名换了
main.js中引入如下缩放代码

var devInnerHeight = 1080.0 // 开发时的InnerHeight
var devDevicePixelRatio = 1.0// 开发时的devicepixelratio
var devScaleFactor = 1.3 // 开发时的ScaleFactor
var scaleFactor = require('electron').screen.getPrimaryDisplay().scaleFactor
var zoomFactor = (window.innerHeight / devInnerHeight) * (window.devicePixelRatio / devDevicePixelRatio) * (devScaleFactor / scaleFactor)
require('electron').webFrame.setZoomFactor(zoomFactor)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants