feat: 根据设备信息自动识别终端类型

This commit is contained in:
wangjiahao 2021-12-21 10:57:37 +08:00
parent db242ba72b
commit 3222f645a1
2 changed files with 6 additions and 6 deletions

View File

@ -123,10 +123,6 @@ export default {
}
},
created() {
const terminalInfo = this.$route.query.terminal
if (terminalInfo) {
this.terminal = terminalInfo
}
},
computed: {
customStyle() {
@ -178,6 +174,7 @@ export default {
}
},
mounted() {
this._isMobile()
const _this = this
const erd = elementResizeDetectorMaker()
// div
@ -206,6 +203,11 @@ export default {
clearInterval(this.timer)
},
methods: {
_isMobile() {
console.log('navigator.userAgent:' + navigator.userAgent)
const flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
this.terminal = flag ? 'mobile' : 'pc'
},
canvasStyleDataInit() {
//
this.searchCount = 0

View File

@ -299,7 +299,6 @@ export default {
//
previewCanvasScale: {
handler(newVal, oldVal) {
console.log('previewCanvasScale:' + JSON.stringify(this.previewCanvasScale))
this.destroyScaleTimeMachine()
this.changeScaleIndex++
this.chartScale(this.changeScaleIndex)
@ -317,7 +316,6 @@ export default {
//
mergeScale() {
const scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient
console.log('scale' + scale + ';this.previewCanvasScale:' + JSON.stringify(this.previewCanvasScale))
const customAttrChart = JSON.parse(this.sourceCustomAttrStr)
const customStyleChart = JSON.parse(this.sourceCustomStyleStr)
recursionTransObj(customAttrTrans, customAttrChart, scale, this.scaleCoefficientType)