我正在尝试在 lit 元素中使用 mdc-component(比如 mdc-textfield)。看起来我必须将 css 和 js 文件都导入到元素中。
我不确定如何将 css 导入到 lit-element 中。
顺便说一句,我使用 polymer serve
没有任何预处理器或编译器。
最佳答案
我建议等待 Material Component Web Components
但是回答你的问题,要使用 MCD 你需要使用 sass,那么你需要一个预编译器。编译为 CSS 后,您可以将其导入到您的组件中:
const anyStyle = html`<style src="path/to/compiled/style.css"></style>`;
我建议您在运行时使用观察器自动构建 sass 文件
polymer serve
关于mdc-components - 如何在 lit 元素中使用 MDC 组件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53248102/