amp-html - Prevent Google amp-autocomplete from closing/hiding for debugging purpose
问题描述
I have a following code which works just fine, but I was wondering is it possible to prevent amp-autocomplete component from closing when clicking outside of it. It adds display:none every time when i try to inspect element in crhome, and it would be good to keep it open while developing, so I can inspect CSS with more ease.
<i role="button" on="tap:autocomplete" class="header__search" tabindex="0"></i>
<amp-lightbox id="autocomplete" layout="nodisplay" class="autocomplete" on="lightboxOpen:autocomplete-query-input.focus">
<form class="sample-form"
method="post"
action-xhr="https://amp.dev/documentation/examples/api/echo"
target="_top">
<amp-autocomplete filter="none" class="autocomplete__component" src="/api/amp/autocomplete" query="query" min-characters="2">
<i class="autocomplete__back" on="tap:quote-lb.close" tabindex="-1" role="button"></i>
<input id="autocomplete-query-input" name="query" class="autocomplete__input">
<template type="amp-mustache" class="autocomplete__result">
<div data-value="{{Label}}" class="autocomplete__result-item">
<a href="/{{Url}}" >
<amp-img layout="fixed" width="27" height="21" src="@GlobalVars.ImageCdnHost{{Image}}?w=27&h=21"></amp-img>
<span>{{Label}}</span>
</a>
</div>
</template>
</amp-autocomplete>
</form>
</amp-lightbox>
解决方案
如果只是在 dev-tools 结果容器中找到怎么办,即:
<div class="i-amphtml-autocomplete-results" role="listbox" id="72_AMP_content_" hidden="">
并删除 hidden="" ?当然,这不是一个理想的解决方案,但是您可以在 chrome 中使用它来刮擦 css。
一切顺利,V。
推荐阅读
- arrays - 保存用户数据时索引超出范围 - Swift
- react-native - 如何将道具(特别是 id)传递给另一个组件?
- r - 混合模型的残差建模:除了 nlme 之外的任何其他软件包?
- android - 如何解决此错误:系统服务在 onCreate() 之前对活动不可用
- typescript - 根据具有默认值的参数返回 Promise 或布尔值
- angular - 更新组件中的变量后角度不更新
- vb.net - 删除或删除在 PictureBox 上绘制的 Rectangle
- qnamaker - 如何将 QnaMaker 与 oneNote 链接
- node.js - Docker 创建和运行镜像失败
- php - PHP Foreach 查询检查