How to get the return value of another method in the vue method

problem:

For example, method A() calls method B(), and then method B returns a value to A. After receiving this method, A will continue to execute the next code. How? ?

solve:

methods: {
            async A() {
                const result = await B();
                // dosomethings . . .
            },
            B() {
                // dosomethings . . .
                return Promise.resolve(data);

            }
        }

My code

   loadMap () {
          ..............
          // map.addControl(newControl);
            return Promise.resolve(map);
      
    },
    async  orientClick(){
      //获得上面的方法的返回值
       var map = await this.loadMap();
       //  map = new T.Map("mapDiv",  {datasourcesControl: true});
       map.panTo(new T.LngLat(110.074846, 39.201972), 15);


    }

Guess you like

Origin blog.csdn.net/he1234555/article/details/115354993