BlockOx
BlockOx
  • 发布:2025-06-20 16:13
  • 更新:2025-06-20 16:13
  • 阅读:25

uni-file-picker在抖音小程序里不触发@select回调方法

分类:uni-app

在uni-file-picker的chooseFileCallback回调方法里添加console打印:

async chooseFileCallback(res) {  
    console.log('选择回调', res)  
    const _extname = get_extname(this.fileExtname)  
       ....  
       this.$emit('select', {  
            tempFiles: currentData,  
            tempFilePaths: filePaths  
    })  
    console.log('选择回调', "this.$emit('select')")  
       ....  
}

我自己的代码:

<uni-file-picker ref="avatar" :modelValue="userAvatar" return-type="object" :limit="1" readonly  
    :auto-upload="false" :del-icon="false" :image-styles="imageStyle" @select="selectPic">  
</uni-file-picker>  

methods: {  
    selectPic: function(event) {  
        console.log('select picture', event)  
        if (event?.tempFilePaths?.[0]) {  
            //上传图片  
                 ...  
        }  
     }  
}

不管是抖音模拟器或真机操作上传,Console日记,只有两个【选择回调】的记录,【select picture】没有打印。

2025-06-20 16:13 负责人:无 分享
已邀请:

要回复问题请先登录注册