加载Vaadin /聚合物自定义元素时出现问题错误消息:0,$ csb__dommodule.DomModule.import不是函数

问题描述

当我尝试加载vaadin自定义元素按钮时,由于收到错误消息(0,$csb__dommodule.DomModule).import is not a function,有人可以帮助我并在这里告诉我我做错了什么吗? TYVM:)

import "@vaadin/vaadin-button";

document.getElementById("app").innerHTML = `
  <h4>Vaadin Button</h4>
  <section>
    <vaadin-button>This is a button</vaadin-button>
  </section>
`;

https://codesandbox.io/s/recursing-swartz-tbe4y?file=/src/index.js

解决方法

这是Codesanbox的特定问题。如果您在本地运行沙箱,则可以正常运行。我刚刚测试过enter image description here

步骤:

  1. 导出沙箱
  2. 运行npm i
  3. 运行npm start

我刚刚在codeandbox客户端存储区中创建了this issue

正在工作的webcomponents.dev演示:https://webcomponents.dev/edit/RvnCgQUcXyckBJdjBCgl

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...