uni-app vue3调用uts插件中的函数,传入的参数对象中有个onClick属性(函数类型)无法设置为null。
interface.uts文件:
export type FloatingButtonOptions = {
iconPath ?: string | null
onClick? : (() => void) | null
}
export type ShowFloatingButton = (options ?: FloatingButtonOptions) => void
index.uts文件:
@UTSJS.keepAlive
export function showFloatingButton(options ?: FloatingButtonOptions) {
console.log(options) //打印结果:{iconPath: null, onClick: function () { [native code] }}
FloatingButtonManager.show(UTSAndroid.getUniActivity(), options?.iconPath, options?.onClick)
}
uni-app vue3中的调用:
showFloatingButton({})
预期结果:
console.log(options) //打印:{iconPath: null, onClick: null }
0 个回复