const { data: res } = await uni.$http.get('/api/public/v1/goods/qsearch', { query: this.kw })
时间: 2023-12-15 13:05:41 浏览: 48
你的第一个问题是关于代码的吗?这段代码看起来是使用uni-app框架中的$http方法发送了一个GET请求到指定的接口,接口地址是"/api/public/v1/goods/qsearch",同时传递了一个名为"query"的参数,值为"this.kw"。返回的响应数据被赋值给了一个名为"res"的变量。
相关问题
async token(ress) { const yonghuxinxi = { name: ress.userInfo.nickName, touxiang: ress.userInfo.avatarUrl } this.gengxinmy(yonghuxinxi) const { data: res } = await uni.$http.post('/login') // console.log(res.token) this.gengtoken(res.token) }
是的,这段代码的作用是获取用户的 token。具体实现是通过调用 `uni.$http.post('/login')` 方法向后端发送请求,获取后端返回的 token,然后调用 `this.gengtoken(res.token)` 方法将 token 存储起来。其中 `this.gengxinmy(yonghuxinxi)` 方法是用来更新用户信息的。需要注意的是,这段代码是异步执行的,因此需要使用 `async/await` 关键字来确保代码的正确执行顺序。
async Search(){ const{ res } = await this.$http.get('music/search',this.input) this.musiclist = res
根据您提供的代码来看,似乎并没有设置 "search" 参数的值。您可以将参数添加到 `this.input` 对象中,例如:
```
this.input = {
search: 'your search keyword'
}
```
另外,如果您使用的是后端框架如 Spring MVC,还需要在后端对应的方法参数中添加 `@RequestParam` 注解来获取请求参数。
希望这些信息对您有所帮助。