vue 中promise 异步请求数据

export function getTypes(type) {
    return listDictItems({ code: type }).then((res) => {
        if (res.code == 200) {
            let list = res.body;
            // console.log('list',list);
            return list;
        }
    })
};

组件中:

 getTypes('EP_TYPE').then((data) => {console.log('data',data)});//成功

posted @ 2018-11-07 16:48  abcByme  阅读(2494)  评论(0编辑  收藏  举报