抚州公司做网站,卡盟网站建设公司,广州网站建设乛新科送推广,南昌网站建设冲浪者科技原因#xff1a;Promise是异步的#xff0c;如果业务逻辑不放在then内部#xff0c;那么可能时机无法拿到then内返回的变量。
解决方案#xff1a;Vueuse库提供了异步计算属性的钩子#xff0c;使用Vueuse库的computedAsync即可。
import { computedAsync } from vueuse…原因Promise是异步的如果业务逻辑不放在then内部那么可能时机无法拿到then内返回的变量。
解决方案Vueuse库提供了异步计算属性的钩子使用Vueuse库的computedAsync即可。
import { computedAsync } from vueuse/corelet getUri computedAsync(async () {let Uri await userGetUri().then((res){Uri res[data]})return Uri})
建议异步操作还是放在Store的Action里面通过async/await方式串行化执行。