微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CSS 样式不适用于 NEXT.js 中带有 amp-bind 的动态类

如何解决CSS 样式不适用于 NEXT.js 中带有 amp-bind 的动态类

amp-bind-class 将“活动”类添加到活动按钮。 当我通过 chrome 开发人员工具看到它时,它工作得很好,但唯一的问题是 CSS 对它们不起作用。 我在 Next.js 中使用 AMP

{foo.map((item,i) => (
    <button
        className="pagination-buttons"
        data-amp-bind-class={
            "data.currentPage==" +
            i +
            "?'pagination-buttons active':'pagination-buttons'"
        }
    >
        {i + 1}
    </button>
))}

在点击任何按钮之前,它看起来像这样:

enter image description here

点击任意按钮后如下所示:

enter image description here

这是我点击后的 DOM

enter image description here

预期:

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。