
如何写精华回答,获更多曝光?
发布
> hvigor ERROR: Failed :entry:default@CompileCangjie...
> hvigor ERROR: Tools execution failed.
error: undeclared identifier '__GenerateResource__'
|
| /* 22.14 */ thisView.observeComponentCreation({ elmtId, isInitialRender => Image(__GenerateResource__("", "", "", app.media.ic_arrow_down_circle, "app.media.ic_arrow_down_circle",[], 20000)).width(24).height(24).margin(left: 4).align(Alignment.BottomEnd).onClick { evt => FileUtil.downloadFileWithRequest(globalContext, msg.content) } }) }.align(Alignment.BottomEnd) }) }.padding(4).backgroundColor(0xffffff).constraintSize(maxWidth: 90.percent).borderRadius(10) }) }.width(100.percent).padding(4)
| ^^^^^^^^^^^^^^^^^^^^
|
note: the error occurs after the macro is expanded
==> D:\workspace\gitee\develop-native-harmonyos-ai-assistant-with-cangjie-video\samples\ch11\CangjieAiAssistant\entry\src\main\cangjie\src\page\chat_line_drawing.cj:22:1:
|
22 | @Builder
| _^
23 | | public func ChatLineDrawing(globalContext: AbilityContext, msg: Message) {
| | ...
48 | | }
| |_^
|
note: the code after the macro is expanded as follows
|
| /* 22.1 */public func ChatLineDrawing(thisView: CustomView, globalContext: ObservedProperty < AbilityContext >, msg: ObservedProperty < Message >): ViewBuilder {
| _^
| | /* 22.2 */
| | /* 22.3 */
| | /* 22.4 */ func ChatLineDrawing__inner__(thisView: CustomView, globalContext: AbilityContext, msg: Message): Unit {
| | /* 22.5 */
| | /* 22.6 */ thisView.observeComponentCreation({ elmtId, isInitialRender =>
| | /* 22.7 */ If {
| | /* 22.8 */
| | /* 22.9 */ if(msg.role == "assistant") {
| | /* 22.10 */ thisView.ifElseBranchUpdateFunction(0, { =>
| | /* 22.11 */
| | /* 22.12 */ thisView.observeComponentCreation({ elmtId, isInitialRender =>
| | /* 22.13 */ Row() { thisView.observeComponentCreation({ elmtId, isInitialRender => Row() { thisView.observeComponentCreation({ elmtId, isInitialRender => Stack() { thisView.observeComponentCreation({ elmtId, isInitialRender => Image(msg.content) })
| | /* 22.14 */ thisView.observeComponentCreation({ elmtId, isInitialRender => Image(__GenerateResource__("", "", "", app.media.ic_arrow_down_circle, "app.media.ic_arrow_down_circle",[], 20000)).width(24).height(24).margin(left: 4).align(Alignment.BottomEnd).onClick { evt => FileUtil.downloadFileWithRequest(globalContext, msg.content) } }) }.align(Alignment.BottomEnd) }) }.padding(4).backgroundColor(0xffffff).constraintSize(maxWidth: 90.percent).borderRadius(10) }) }.width(100.percent).padding(4)
| | /* 22.15 */ })
| | /* 22.16 */
| | /* 22.17 */ })
| | /* 22.18 */
| | /* 22.19 */ }
| | /* 22.20 */ else
| | /* 22.21 */ {
| | /* 22.22 */ thisView.ifElseBranchUpdateFunction(1, { =>
| | /* 22.23 */
| | /* 22.24 */ thisView.observeComponentCreation({ elmtId, isInitialRender =>
| | /* 22.25 */ Row() { thisView.observeComponentCreation({ elmtId, isInitialRender => Row() { thisView.observeComponentCreation({ elmtId, isInitialRender => Text(msg.content).fontSize(20) }) }.padding(4).backgroundColor(0x96ef6b).borderRadius(10).constraintSize(maxWidth: 90.percent) }) }.width(100.percent).padding(4).justifyContent(FlexAlign.End)
| | /* 22.26 */ })
| | /* 22.27 */
| | /* 22.28 */ })
| | /* 22.29 */
| | /* 22.30 */ }
| | /* 22.31 */
| | /* 22.32 */ }
| | /* 22.33 */ })
| | /* 22.34 */
| | /* 22.35 */
| | /* 22.36 */ }
| | /* 22.37 */
| | /* 22.38 */
| | /* 22.39 */ ViewBuilder { ChatLineDrawing__inner__(thisView, globalContext.get(), msg.get()) }
| | /* 22.40 */
| | /* 22.41 */}
| | /* 22.42 */
| |___________^