fix: 系统组件修改配置时,修复出现'TypeError: _this99220refs.customStyle is not a function'的问题

main
wu.jian2 2 years ago
parent 89c5f95e2f
commit 9781e2c783

@ -90,7 +90,8 @@ export default {
}, },
linkage (row) { linkage (row) {
this.$emit('linkage', row) this.$emit('linkage', row)
} },
customStyle () {}
} }
} }
</script> </script>

@ -20,7 +20,9 @@
'font-weight':customize.firstWeight, 'font-weight':customize.firstWeight,
'margin-bottom':customize.lineDistance +'px' 'margin-bottom':customize.lineDistance +'px'
}" }"
>{{tableData?tableData:'' }}</div> >
{{ tableData?tableData:'' }}
</div>
<div <div
:style="{ :style="{
'font-size': customize.secondSize + 'px', 'font-size': customize.secondSize + 'px',
@ -28,7 +30,8 @@
color:customize.secondColor, color:customize.secondColor,
'font-weight':customize.secondWeight, 'font-weight':customize.secondWeight,
}" }"
class="content-right-second"> class="content-right-second"
>
{{ customize.secondLine }} {{ customize.secondLine }}
</div> </div>
</div> </div>
@ -49,7 +52,7 @@ export default {
default: () => ({}) default: () => ({})
} }
}, },
data() { data () {
return { return {
customClass: {} customClass: {}
} }
@ -81,6 +84,7 @@ export default {
} }
}, },
methods: { methods: {
customStyle () {}
} }
} }
</script> </script>

@ -14,6 +14,7 @@
<script> <script>
import AMapLoader from '@amap/amap-jsapi-loader' import AMapLoader from '@amap/amap-jsapi-loader'
import cloneDeep from 'lodash/cloneDeep'
export default { export default {
name: 'RemoteMap', name: 'RemoteMap',
props: { props: {
@ -44,13 +45,14 @@ export default {
}, },
mounted () { mounted () {
this.initMap() this.initMap(this.customize)
}, },
methods: { methods: {
initMap () { initMap (customize) {
this.loading = true this.loading = true
this.updateKey = 0
AMapLoader.load({ AMapLoader.load({
key: this.customize.mapKey || '1b0a1423b70bbcbc20c9c87327e5e94e', // WebKey load key: customize.mapKey || '1b0a1423b70bbcbc20c9c87327e5e94e', // WebKey load
version: '1.4.15', // JSAPI 1.4.15 version: '1.4.15', // JSAPI 1.4.15
plugins: [ plugins: [
'AMap.ToolBar', 'AMap.ToolBar',
@ -64,12 +66,12 @@ export default {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
this.map = new AMap.Map(`map-${this.config.code}`, { this.map = new AMap.Map(`map-${this.config.code}`, {
resizeEnable: true, // resizeEnable: true, //
lang: this.customize.lang, lang: customize.lang,
mapStyle: `amap://styles/${this.customize.mapStyle}`, mapStyle: `amap://styles/${customize.mapStyle}`,
center: [this.customize.lng, this.customize.lat], center: [customize.lng, customize.lat],
features: this.customize.features, features: customize.features,
zoom: this.customize.zoom, zoom: customize.zoom,
viewMode: this.customize.viewMode, viewMode: customize.viewMode,
plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.MapType', 'AMap.Geolocation'] plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.MapType', 'AMap.Geolocation']
}) })
this.loading = false this.loading = false
@ -85,7 +87,7 @@ export default {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
this.map.addControl(new AMap.Geolocation()) this.map.addControl(new AMap.Geolocation())
let marker = null // let marker = null //
if (this.customize.markerSpan) { if (customize.markerSpan) {
// //
const markerContent = document.createElement('div') const markerContent = document.createElement('div')
markerContent.style.position = 'absolute' markerContent.style.position = 'absolute'
@ -102,7 +104,7 @@ export default {
// //
const markerSpan = document.createElement('span') const markerSpan = document.createElement('span')
markerSpan.className = 'marker' markerSpan.className = 'marker'
markerSpan.innerHTML = this.customize.markerSpan markerSpan.innerHTML = customize.markerSpan
markerContent.appendChild(markerSpan) markerContent.appendChild(markerSpan)
// //
if (marker) { if (marker) {
@ -111,7 +113,7 @@ export default {
// //
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
marker = new AMap.Marker({ marker = new AMap.Marker({
position: [this.customize.markerLng, this.customize.markerLat], position: [customize.markerLng, customize.markerLat],
content: markerContent, content: markerContent,
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
offset: new AMap.Pixel(0, 0) // 使 offset: new AMap.Pixel(0, 0) // 使
@ -130,6 +132,11 @@ export default {
} }
} }
}) })
},
customStyle (config) {
if (config && config.option && config.option.customize) {
this.initMap(config.option.customize)
}
} }
} }
} }

@ -71,6 +71,7 @@ export default {
} }
}, },
methods: { methods: {
customStyle () {}
} }
} }
</script> </script>

@ -116,6 +116,13 @@ const option = {
export default { export default {
title, title,
option, setting,
setting option: {
...option,
displayOption: {
dataAllocation: {
enable: false
}
}
}
} }

@ -141,7 +141,9 @@ export default {
rightDiagonal.style.top = `${this.customize.borderWidth / 2}px` rightDiagonal.style.top = `${this.customize.borderWidth / 2}px`
} }
}, },
methods: {} methods: {
customStyle () {}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -36,7 +36,7 @@
'font-weight':customize.firstWeight, 'font-weight':customize.firstWeight,
'margin-bottom':customize.lineDistance +'px' 'margin-bottom':customize.lineDistance +'px'
}" }"
>{{tableData?tableData:'' }}</span> >{{ tableData?tableData:'' }}</span>
<span <span
:style="{ :style="{
'font-size': customize.secondSize + 'px', 'font-size': customize.secondSize + 'px',
@ -44,7 +44,8 @@
color:customize.secondColor, color:customize.secondColor,
'font-weight':customize.secondWeight, 'font-weight':customize.secondWeight,
}" }"
class="content-right-second"> class="content-right-second"
>
{{ customize.secondLine }} {{ customize.secondLine }}
</span> </span>
</div> </div>
@ -63,7 +64,7 @@ export default {
default: () => ({}) default: () => ({})
} }
}, },
data() { data () {
return { return {
customClass: {} customClass: {}
} }
@ -94,6 +95,7 @@ export default {
} }
}, },
methods: { methods: {
customStyle () {}
} }
} }
</script> </script>

Loading…
Cancel
Save