1. <tfoot id='uEQub'></tfoot>
    2. <small id='uEQub'></small><noframes id='uEQub'>

    3. <legend id='uEQub'><style id='uEQub'><dir id='uEQub'><q id='uEQub'></q></dir></style></legend>
        <bdo id='uEQub'></bdo><ul id='uEQub'></ul>
        <i id='uEQub'><tr id='uEQub'><dt id='uEQub'><q id='uEQub'><span id='uEQub'><b id='uEQub'><form id='uEQub'><ins id='uEQub'></ins><ul id='uEQub'></ul><sub id='uEQub'></sub></form><legend id='uEQub'></legend><bdo id='uEQub'><pre id='uEQub'><center id='uEQub'></center></pre></bdo></b><th id='uEQub'></th></span></q></dt></tr></i><div id='uEQub'><tfoot id='uEQub'></tfoot><dl id='uEQub'><fieldset id='uEQub'></fieldset></dl></div>

        如何在 Ionic 2 中定位弹出框

        时间:2023-09-08

        1. <legend id='CARC4'><style id='CARC4'><dir id='CARC4'><q id='CARC4'></q></dir></style></legend>

              <bdo id='CARC4'></bdo><ul id='CARC4'></ul>
              <tfoot id='CARC4'></tfoot>
              <i id='CARC4'><tr id='CARC4'><dt id='CARC4'><q id='CARC4'><span id='CARC4'><b id='CARC4'><form id='CARC4'><ins id='CARC4'></ins><ul id='CARC4'></ul><sub id='CARC4'></sub></form><legend id='CARC4'></legend><bdo id='CARC4'><pre id='CARC4'><center id='CARC4'></center></pre></bdo></b><th id='CARC4'></th></span></q></dt></tr></i><div id='CARC4'><tfoot id='CARC4'></tfoot><dl id='CARC4'><fieldset id='CARC4'></fieldset></dl></div>
                <tbody id='CARC4'></tbody>
                • <small id='CARC4'></small><noframes id='CARC4'>

                  本文介绍了如何在 Ionic 2 中定位弹出框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  如何在 Ionic 2 中手动定位弹出框?

                  How do I manually position a popover in Ionic 2?

                  我无法在 css 类中设置位置,因为弹出框控制器使用内联样式设置位置.

                  I can't set the position in a css class, since the popover controller sets the position with an inline style.

                  推荐答案

                  查看代码,弹出框的位置似乎没有选项.但是,当由于用户点击某物而打开弹出框时,它可以通过点击事件定位.我们也可以将这些知识用于手动定位:

                  Looking through the code, there doesn't seem to be an option for the popover's position. However, when opening the popover as a result of the user tapping something, it can be positioned by the click event. We can use that knowledge for manual positioning as well:

                  let pop = this.popoverCtrl.create(MyPopover);
                  
                  let ev = {
                    target : {
                      getBoundingClientRect : () => {
                        return {
                          top: 100
                        };
                      }
                    }
                  };
                  
                  pop.present({ev});
                  

                  需要注意的几点:

                  • 您可以设置 topleft 或两者的值.
                  • 值必须以像素为单位,如数字.
                  • 如果 topleft 没有给出,那么通常的定位算法将用于该值.
                  • You can set the value for top, left, or both.
                  • The values must be given in pixels, as numbers.
                  • If top or left is not given, then the usual positioning algorithm is used for that value.

                  我很高兴知道是否有更好的方法,但到目前为止这是我能想到的最好方法.

                  I'd be happy to know if there's a better way, but so far this is the best I could come up with.

                  这当然适用于 Ionic2 和 3,很高兴有人确认它是否也适用于 Ionic4!

                  This certainly works in Ionic2 and 3, happy to have someone confirm if it works in Ionic4 as well!

                  这篇关于如何在 Ionic 2 中定位弹出框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在渲染“页面"之前获取数据异步 下一篇:加载图像时显示加载图标

                  相关文章

                  最新文章

                • <small id='h2kdY'></small><noframes id='h2kdY'>

                  <legend id='h2kdY'><style id='h2kdY'><dir id='h2kdY'><q id='h2kdY'></q></dir></style></legend>

                      <bdo id='h2kdY'></bdo><ul id='h2kdY'></ul>
                    1. <tfoot id='h2kdY'></tfoot>
                      <i id='h2kdY'><tr id='h2kdY'><dt id='h2kdY'><q id='h2kdY'><span id='h2kdY'><b id='h2kdY'><form id='h2kdY'><ins id='h2kdY'></ins><ul id='h2kdY'></ul><sub id='h2kdY'></sub></form><legend id='h2kdY'></legend><bdo id='h2kdY'><pre id='h2kdY'><center id='h2kdY'></center></pre></bdo></b><th id='h2kdY'></th></span></q></dt></tr></i><div id='h2kdY'><tfoot id='h2kdY'></tfoot><dl id='h2kdY'><fieldset id='h2kdY'></fieldset></dl></div>