Blame view

node_modules/vue-baidu-map/components/layers/Traffic.vue 605 Bytes
290144e9   易尊强   第一次
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  <script>
  import commonMixin from '../base/mixins/common.js'
  
  export default {
    name: 'bm-triffic',
    render (h) {},
    mixins: [commonMixin('layer')],
    props: {
      predictDate: {
        type: Object
      }
    },
    watch: {
      'pridictDate.weekday' () {
        this.reload()
      },
      'pridictDate.hour' () {
        this.reload()
      },
      pridictDate () {
        this.reload()
      }
    },
    methods: {
      load () {
        const {pridictDate, BMap, map} = this
        this.originInstance = new BMap.TrafficLayer({
          pridictDate
        })
        map.addTileLayer(this.originInstance)
      }
    }
  }
  </script>