【发布时间】:2018-12-02 16:33:26
【问题描述】:
我已导入Material Design 库的 css 和 js 文件,但由于某种原因,即使其下方的按钮组件显示正确,文本字段也无法正常工作。
看起来 JS 根本没有被应用
Codepen: https://codepen.io/x84733/pen/yEEbjK
<script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
<style>@import url("https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css");</style>
<div class="mdc-text-field">
<input type="text" id="my-text-field" class="mdc-text-field__input">
<label class="mdc-floating-label" for="my-text-field">Hint text</label>
<div class="mdc-line-ripple"></div>
</div>
<button class="foo-button mdc-button">Button</button>
text-field 组件代码取自文档:
https://material.io/develop/web/components/input-controls/text-field/
【问题讨论】:
标签: javascript css material-design