简体   繁体   English

如何在Foundation Apps中正确关闭操作表?

[英]How to properly close an action-sheet in Foundation Apps?

I have the exact same action sheet as in the example: 我有与示例完全相同的操作表:

<div zf-action-sheet="">
  <div zf-as-button="" title="I'm an Action Sheet"></div>
  <div zf-as-content="" position="bottom">
    <p>Tap to share</p>
    <ul>
      <li><a href="#">Twitter</a></li>
      <li><a href="#">Facebook</a></li>
      <li><a href="#">Mail</a></li>
    </ul>
  </div>
</div>

How do I tell Foundation Apps to close the action sheet when clicking on the links? 单击链接时,如何告诉Foundation Apps关闭操作表? I'd rather not name my action sheet if possible. 如果可能的话,我宁愿不给我的行动表命名。 From the docs it seems I should be able to just add zf-hide="" or zf-close="" to the links but neither work. 从文档看来,我应该能够只将zf-hide=""zf-close=""到链接中,但均无效。

From this it looks like by default it will close only if you click outside of it. 这个它看起来像在默认情况下,如果你点击它外面只会关闭。 And from this I think you have to name your action sheet within its id attribute. 因此,我认为您必须在其id属性中命名操作表。 Then you can use zf-close inside your links . 然后,您可以在links中使用zf-close

This worked for me but the href attribute will be ignored and the link won't take you any where unless you use ui-sref instead : 这对我有用,但是href属性将被忽略,除非您使用ui-sref ,否则该链接将不会带您到任何地方:

<div id="MyActionSheet" zf-action-sheet="">
  <div zf-as-button="" title="I'm an Action Sheet"></div>
  <div zf-as-content="" position="bottom">
    <p>Tap to share</p>
    <ul>
      <li><a zf-close="MyActionSheet" href="#">Twitter</a></li>
      <!-- 'href' attribute will be ignored so this is same as href="#"-->
      <li><a zf-close="MyActionSheet" href="/Facebook">Facebook</a></li>
      <!-- this will take you to the 'mail' page -->
      <li><a zf-close="MyActionSheet" ui-sref="mail">Mail</a></li>
    </ul>
  </div>
</div>

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

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