项目场景:

在uni-app中尝试使用接口获得用户头像 但是出错了


问题描述

vue中template配置:

<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
	<image class="avatar" src:avatarUrl></image>
	</button> 

methods配置:

<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
	<image class="avatar" src:avatarUrl></image>
	</button> 

点击按钮报错: Component "pages/login/login" does not have a method "onChooseAvatar" to handle event "chooseavatar"

@Override
	public void run() {
		bytes = mmInStream.read(buffer);
		mHandler.obtainMessage(READ_DATA, bytes, -1, buffer).sendToTarget();
	}

解决方案:

将bind:chooseavatar="onChooseAvatar"修改为@chooseavatar="onChooseAvatar"解决

例如:将原 bind:chooseavatar="onChooseAvatar" 语句修改为 @chooseavatar="onChooseAvatar"问题解决.

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐