修复组件缺少名字的问题
This commit is contained in:
		@@ -5,34 +5,36 @@
 | 
				
			|||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
  import * as echarts from 'echarts'
 | 
					import * as echarts from 'echarts'
 | 
				
			||||||
  import http from "dui/lib/js/request";
 | 
					import http from "dui/lib/js/request";
 | 
				
			||||||
  export default {
 | 
					 | 
				
			||||||
    name: '',
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    data () {
 | 
					export default {
 | 
				
			||||||
 | 
					  name: 'AiDvMap',
 | 
				
			||||||
 | 
					  data() {
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      timer: null,
 | 
					      timer: null,
 | 
				
			||||||
      v: `AiDvMap-${new Date().getTime()}`,
 | 
					      v: `AiDvMap-${new Date().getTime()}`,
 | 
				
			||||||
      chart: null
 | 
					      chart: null
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
    directives:{
 | 
					  directives: {
 | 
				
			||||||
    resize: {
 | 
					    resize: {
 | 
				
			||||||
      bind(el, binding) {
 | 
					      bind(el, binding) {
 | 
				
			||||||
        let width = ''
 | 
					        let width = ''
 | 
				
			||||||
        let height = ''
 | 
					        let height = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        function isReize() {
 | 
					        function isReize() {
 | 
				
			||||||
          const style = document.defaultView.getComputedStyle(el)
 | 
					          const style = document.defaultView.getComputedStyle(el)
 | 
				
			||||||
          if (width !== style.width || height !== style.height) {
 | 
					          if (width !== style.width || height !== style.height) {
 | 
				
			||||||
            binding.value({
 | 
					            binding.value({
 | 
				
			||||||
              width: style.width,
 | 
					              width: style.width,
 | 
				
			||||||
                height:style.height
 | 
					              height: style.height
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          width = style.width
 | 
					          width = style.width
 | 
				
			||||||
          height = style.height
 | 
					          height = style.height
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        el.__vueSetInterval__ = setInterval(isReize, 300)
 | 
					        el.__vueSetInterval__ = setInterval(isReize, 300)
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -41,20 +43,20 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
    mounted () {
 | 
					  mounted() {
 | 
				
			||||||
    this.$nextTick(() => {
 | 
					    this.$nextTick(() => {
 | 
				
			||||||
      this.initChart()
 | 
					      this.initChart()
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
      onDomResize () {
 | 
					    onDomResize() {
 | 
				
			||||||
      this.$nextTick(() => {
 | 
					      this.$nextTick(() => {
 | 
				
			||||||
        this.chart.resize()
 | 
					        this.chart.resize()
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      initChart () {
 | 
					    initChart() {
 | 
				
			||||||
      this.chart = echarts.init(document.querySelector(`.${this.v}`))
 | 
					      this.chart = echarts.init(document.querySelector(`.${this.v}`))
 | 
				
			||||||
      this.getData().then(res => {
 | 
					      this.getData().then(res => {
 | 
				
			||||||
        if (res.code === 0) {
 | 
					        if (res.code === 0) {
 | 
				
			||||||
@@ -216,13 +218,13 @@
 | 
				
			|||||||
      })
 | 
					      })
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      convertData (data) {
 | 
					    convertData(data) {
 | 
				
			||||||
      return data.map(v => {
 | 
					      return data.map(v => {
 | 
				
			||||||
        return [this.qqMapTransBMap(v.point[1], v.point[0]).lng, this.qqMapTransBMap(v.point[1], v.point[0]).lat, v.value, v.name]
 | 
					        return [this.qqMapTransBMap(v.point[1], v.point[0]).lng, this.qqMapTransBMap(v.point[1], v.point[0]).lat, v.value, v.name]
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      qqMapTransBMap (lng, lat) {
 | 
					    qqMapTransBMap(lng, lat) {
 | 
				
			||||||
      const x_pi = 3.14159265358979324 * 3000.0 / 180.0
 | 
					      const x_pi = 3.14159265358979324 * 3000.0 / 180.0
 | 
				
			||||||
      var x = lng
 | 
					      var x = lng
 | 
				
			||||||
      var y = lat
 | 
					      var y = lat
 | 
				
			||||||
@@ -235,19 +237,19 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      getData () {
 | 
					    getData() {
 | 
				
			||||||
        return http.post(`/app/appdvcpconfig/apiForward?url=${encodeURIComponent(`https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=${this.$store.state.user.info.areaId.substr(0, 6)}`)}`, )
 | 
					      return http.post(`/app/appdvcpconfig/apiForward?url=${encodeURIComponent(`https://geo.datav.aliyun.com/areas_v3/bound/geojson?code=${this.$store.state.user.info.areaId.substr(0, 6)}`)}`,)
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style lang="scss" scoped>
 | 
					<style lang="scss" scoped>
 | 
				
			||||||
  .AiDvMap {
 | 
					.AiDvMap {
 | 
				
			||||||
  display: flex;
 | 
					  display: flex;
 | 
				
			||||||
  align-items: center;
 | 
					  align-items: center;
 | 
				
			||||||
  justify-content: center;
 | 
					  justify-content: center;
 | 
				
			||||||
  width: 100%;
 | 
					  width: 100%;
 | 
				
			||||||
  height: 100%;
 | 
					  height: 100%;
 | 
				
			||||||
  }
 | 
					}
 | 
				
			||||||
</style>
 | 
					</style>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,7 +18,6 @@ const install = function (Vue) {
 | 
				
			|||||||
  let contexts = require.context('.', true, /[\\\/]Ai([^\\\/]+)\.vue$/);
 | 
					  let contexts = require.context('.', true, /[\\\/]Ai([^\\\/]+)\.vue$/);
 | 
				
			||||||
  if (contexts) {
 | 
					  if (contexts) {
 | 
				
			||||||
    contexts.keys().map((e) => {
 | 
					    contexts.keys().map((e) => {
 | 
				
			||||||
      console.log(e)
 | 
					 | 
				
			||||||
      components.push(contexts(e).default);
 | 
					      components.push(contexts(e).default);
 | 
				
			||||||
      Vue.component(contexts(e).default.name, contexts(e).default);
 | 
					      Vue.component(contexts(e).default.name, contexts(e).default);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user