因此,当用户单击反应中的按钮时,我尝试创建一个背景为灰色的弹出菜单我的代码如下所示:
//ifButtonClicked called another class. this function only runs if another //button is clicked
//some code
export function ifButtonClicked(){
var element = document.createElement("div");
var post_settings = document.createElement("div");
post_settings.className = "post_settings";
post_settings.innerHTML = "button"
post_settings.onclick = (event) => onClickPostSettings(event);
element.append(post_settings);
}
function onClickPostSettings(event){
//I want it to popup a menu here
}
*/
由于我无法使用 HTML 标签,我想知道是否有任何方法可以在 onClick 上实现弹出菜单。我应该创建一个新类并在 onClickPostsettings 中调用该类吗?
largeQ
相关分类