久久久久久AV无码免费看大片,亚洲一区精品人人爽人人躁,国产成人片无码免费爱线观看,亚洲AV成人无码精品网站,为什么晚上搞的时候要盖被子

vue中created、mounted等方法

時(shí)間:2019-09-07 16:51:04 類型:vue
字號(hào):    
created:html加載完成之前,執(zhí)行。執(zhí)行順序:父組件-子組件

mounted:html加載完成后執(zhí)行。執(zhí)行順序:子組件-父組件

methods:事件方法執(zhí)行

watch:watch是去監(jiān)聽一個(gè)值的變化,然后執(zhí)行相對(duì)應(yīng)的函數(shù)。

computed:computed是計(jì)算屬性,也就是依賴其它的屬性計(jì)算所得出最后的值
export default {
     name: "draw",
     data(){      // 定義變量source        
       return {
         source:new ol.source.Vector({wrapX: false}),

       }
     },
    props:{ //接收父組件傳遞過來的參數(shù)
      map:{
        //type:String
      },

    },

mounted(){   //頁(yè)面初始化方法
    if (map==map){

    }
    var vector = new ol.layer.Vector({
      source: this.source
    });
    this.map.addLayer(vector);

  },
  watch: {   //監(jiān)聽值變化:map值
    map:function () {
      console.log('3333'+this.map);
      //return this.map
      console.log('444444'+this.map);

      var vector = new ol.layer.Vector({
        source: this.source
      });
      this.map.addLayer(vector);
    }
  },
  methods:{   //監(jiān)聽方法  click事件等,執(zhí)行drawFeatures方法
       drawFeatures:function(drawType){}
}