【文件属性】:
文件名称:webcomponent:用于构建Web组件的轻量级实用程序
文件大小:76KB
文件格式:ZIP
更新时间:2021-05-04 19:42:32
webcomponents JavaScript
网络组件
用于构建轻量级实用程序
安装
通过npm安装,用于与打包器(例如Webpack或Browserify :
npm install --save webcomponent
如果您的目标环境没有对Web组件的本机支持,则应包括一个单独的例如 。
用法
通过扩展WebComponent类而不是HTMLElement来注册Web组件:
import WebComponent from 'webcomponent' ;
class MyWidget extends WebComponent {
connectedCallback ( ) {
// ...
}
get myprop ( ) {
// ...
}
// etc
}
customElements . define ( 'my-widget' , MyWidget ) ;
WebComp
【文件预览】:
webcomponent-master
----.gitignore(19B)
----.babelrc(25B)
----wct.conf.json(1KB)
----package.json(1KB)
----package-lock.json(210KB)
----.github()
--------workflows()
----README.md(3KB)
----demo()
--------package.json(531B)
--------package-lock.json(134KB)
--------webpack.config.js(571B)
--------index.js(535B)
--------index.template.html(190B)
----lib()
--------index.js(1KB)
--------extendable-html-element.js(2KB)
--------index.d.ts(1KB)
----.npmignore(14B)
----test()
--------webpack.config.js(569B)
--------index.js(6KB)
--------index.html(314B)
--------fixtures.js(465B)