【发布时间】:2021-07-09 02:47:14
【问题描述】:
有一个名为“shoelace”(https://shoelace.style/getting-started/usage)的库,它是使用 stencil.js 构建的 Web 组件的集合。我想在我现有的 stencil.js 项目中使用该库中的组件。
但是,当我按照说明使用 NPM 进行本地安装时,它不起作用,即使该组件似乎已加载。
我在尝试渲染鞋带的按钮组件时收到以下错误:
Class constructor SlButton cannot be invoked without 'new'
这是我的test-button.tsx 组件:
import { Component, h} from '@stencil/core';
import '@shoelace-style/shoelace/dist/themes/base.css';
import SlButton from '@shoelace-style/shoelace/dist/components/button/button';
@Component({
tag: 'test-button',
shadow: true,
})
export class TestButton {
render() {
return (
<div>
<SlButton>hdcsddsy</SlButton>
</div>
);
}
}
这里有什么问题?
【问题讨论】:
标签: typescript import web-component stenciljs shoelace