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