如何写精华回答,获更多曝光?
发布
try { getContext(this).resourceManager.getRawFileContent("MapData.json", (error: BusinessError, value: Uint8Array) => { const textDecoder = util.TextDecoder.create("utf-8"); const res = textDecoder.decodeWithStream(value, { stream: false }); this.sections = JSON.parse(res); });} catch (error) { console.error(`callback getRawFileContent failed, error is ${JSON.stringify(error)}`)}
捕获错误 callback getRawFileContent failed, error is {}
从学堂直接拉取的代码