【问题标题】:amp-bind not working inside to change an element's class inside AMP Storyamp-bind 无法在内部更改 AMP Story 中的元素类
【发布时间】:2019-10-08 11:07:19
【问题描述】:

我在 AMP 故事页面中创建了一个侧边栏。

在侧边栏内,我有一个带有链接和子菜单的菜单。当使用此代码单击其父项时,我正在尝试向子菜单项添加一个“活动”类

<div class="caret" on="tap:AMP.setState({sidebar.openMenu: 1})">

然后用

抓住子菜单项中的切换
<ul [class]="sidebar.openMenu ? 'active' : ''" class="subMenu">

问题是当我点击父菜单项时,控制台错误

AMP.setState 未列入白名单

出现并且没有任何变化。

如何将 AMP 故事页面侧边栏中的 AMP.setState 操作列入白名单?

【问题讨论】:

    标签: amp-html amp-list amp-bind


    【解决方案1】:

    您不需要amp-bind 来创建多级amp-sidebar 导航,use AMP actions and events instead.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多