同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
The <menu> component provides menus as temporary pop-up windows to display operations that can be performed by users.
None
Triggered when a value in the menu is selected. The returned value is the value attribute of the <option> component. |
||
Whether the font size changes with the system's font size settings. |
||||
Font style of the menu. For details, see font-style of the text component. |
||||
Font weight of the menu. For details, see font-weight of the text component. |
||||
Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font that exists in the system or the font specified by Custom Font Styles in the family is selected as the font for the text. |
The following methods are supported.
<!-- xxx.hml -->
<div class="container">
<text onclick="onTextClick" class="title-text">Show popup menu.</text>
<menu id="apiMenu" onselected="onMenuSelected">
<option value="Item 1">Item 1</option>
<option value="Item 2">Item 2</option>
<option value="Item 3">Item 3</option>
</menu>
</div>
/* xxx.css */
.container {
flex-direction: column;
align-items: flex-start;
justify-content: center;
}
.title-text {
margin: 20px;
}
// xxx.js
import prompt from '@system.prompt';
export default {
onMenuSelected(e) {
prompt.showToast({
message: e.value
})
},
onTextClick() {
this.$element("apiMenu").show({x:280,y:120});
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。