【发布时间】:2021-02-23 20:09:39
【问题描述】:
我想在我的 Word 插件中使用 Web 组件,但我有一个简单测试出现的错误,错误如下: 无法获取未定义或空引用的属性“定义”。
提前致谢!
Test.js
class MyProduct extends HTMLElement {
constructor() {
super();
this.innerHTML = "hello";
}
}
window.customElements.define('my-product', MyProduct); //The error is just here
Test.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>Word Add-In with Commands Sample</title>
<script type="module" src="Test.js"></script>
</head>
<body>
<my-product></my-product>
</body>
</html>
【问题讨论】:
标签: javascript visual-studio office-js web-component word-addins