HarmonyOS bindPopup里面的message如何指定resource?

如题:HarmonyOS bindPopup里面的message如何指定resource?

阅读 408
1 个回答

直接引用string.json里的内容可以采取以下方式:

string.json

{
  "name": "uuuu",
  "value": "This is a popup with PopupOptions"
}
.bindPopup(this.handlePopup, {
  message: getContext(this).resourceManager.getStringSync($r('app.string.uuuu').id),
  placementOnTop: true,
  showInSubWindow:false,
  primaryButton: {
    value: 'confirm',
    action: () => {
      this.handlePopup = !this.handlePopup
      console.info('confirm Button click')
    }
  },
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进