gpt4 book ai didi

javascript - Material Design 图标按钮无法正常工作

转载 作者:行者123 更新时间:2023-12-02 21:49:04 25 4
gpt4 key购买 nike

我正在创建一个应用程序栏 Material Design使用他们的网络组件。这是我的 HTML:

<header class=" mdc-top-app-bar material-icons">
<div class="mdc-top-app-bar__row">
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-start">
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__navigation-icon--unbounded">menu</button><span class="mdc-top-app-bar__title">San Francisco, CA</span> </section>
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-end">
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__action-item--unbounded" aria-label="Download">file_download</button>
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__action-item--unbounded" aria-label="Print this page">print</button>
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__action-item--unbounded" aria-label="Bookmark this page">bookmark</button>
</section>
</div>
</header>

我的 JS 文件是:

 const topAppBarElement = document.querySelector('.mdc-top-app-bar');
const topAppBar = new mdc.topAppBar.MDCTopAppBar.attachTo(topAppBarElement);
const iconButtonRipples = [].map.call(document.querySelectorAll('.mdc-icon-button'), function(el) {
return new mdc.ripple.MDCRipple.attachTo(el);
});
iconButtonRipples.unbounded = true;

Material Design navigation bar with MDC ripple not working correctly

如何解决这个问题?

最佳答案

使用此代码:

<header class=" mdc-top-app-bar material-icons">
<div class="mdc-top-app-bar__row">
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-start">
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__action-item">menu</button><span class="mdc-top-app-bar__title">San Francisco, CA</span> </section>
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-end">
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__action-item" aria-label="Download">file_download</button>
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__action-item" aria-label="Print this page">print</button>
<button class="mdc-icon-button mcw-icons mdc-top-app-bar__action-item" aria-label="Bookmark this page">bookmark</button>
</section>
</div>
</header>

还有:

const topAppBarElement = document.querySelector('.mdc-top-app-bar');
const topAppBar = new mdc.topAppBar.MDCTopAppBar.attachTo(topAppBarElement);

关于javascript - Material Design 图标按钮无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60175723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com