简体   繁体   English

使用Onsen Ui创建类似Android的Popover

[英]Create an Android-like Popover with Onsen Ui

I am currently creating an Android App with Phonegap + Onsen UI. 我目前正在使用Phonegap + Onsen UI创建一个Android应用。 Now, I have an Android-like more Button (three dots) in my menu, and when somebody clicks on it, I want to open this typical "More-Button Menu". 现在,我的菜单中有一个类似Android的More Button(三个点),当有人单击它时,我想打开此典型的“ More-Button菜单”。 There is an example for an android popover with onsen ui over here , but when you take a look at the components documentation , you can't read something about the android popover anymore. 有与温泉UI在Android酥料饼的例子在这里 ,但是当你看看的组件文件 ,你不能阅读一些关于Android的酥料饼了。

My problem is, that when I take the popover code from the example, I cant open it with the code from the documentation: 我的问题是,当我从示例中获取弹出代码时,无法使用文档中的代码打开它:

  ons.createPopover('more-popover.html').then(function(popover) {
    $scope.popover = popover;
  });

more-popover.html: 更popover.html:

<div class="popover-mask"></div>
<div class="popover popover--up popover" style="top:10px;right:10px;">
  <div class="popover__content popover__content--android">
    <div style="text-align:center;opacity:0.4;margin-top:40px">Content</div>
  </div>
</div>

But when I try to use it like from the documentation, the popover opens, but I did not found any possibility to get the android style working. 但是,当我尝试像从文档中那样使用它时,会打开弹出窗口,但是我没有发现使android样式正常工作的任何可能性。

Is there a way to use the ons.createPopover Function with the above code from "more-popover.html" or any other way? 有没有办法将ons.createPopover函数与“ more-popover.html”中的上述代码结合使用?

I solved the problem with using this inside the more-popover.html: 我在more-popover.html中解决了这个问题:

<ons-popover modifier="android more" cancelable>
    <ons-list>
      <ons-list-item ng-click="share()" modifier="tappable">Teilen</ons-list-item>
      <ons-list-item ng-click="quit()" modifier="tappable">Beenden</ons-list-item>
    </ons-list>
</ons-popover>

With setting the modifier to android, I've got the Android Style. 通过将修改器设置为android,我得到了Android样式。 I also added more as modifier, so that I can remove the arrows, if the popoverarrow is a sub-element of the "more"-popover: 我还添加了更多作为修饰符,以便如果popoverarrow是“ more” -popover的子元素,则可以删除箭头:

app.css: app.css:

.popover--more .popover__right-arrow, .popover__bottom-arrow, .popover__left-arrow, .popover__top-arrow {
  display: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM