k-water/electron-filesystem

npm run build之后样式不对

luckxiang opened this issue · 3 comments

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

问题我自己处理了,主要是屏幕分辨率适配的问题,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打包后样式变大以及不同分辨率屏幕适配问题

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

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)