light-dark-switch
v0.1.0
Published
A lit web component.
Downloads
1
Readme
light-dark-switch
light-dark-switch是根据html标签类名驱动的Web Component,它可以在任何位置使用。
Quick Start
Install
npm i light-dark-switch
Import
in index.html
<script src='./node/moduels/light-dark-switch/light-dark-switch.js'></script>
in main.js
import 'light-dark-switch/light-dark-switch.js'
in main.ts
import 'light-dark-switch/light-dark-switch'
Usage
<light-dark-switch></light-dark-switch>
<light-dark-switch selected></light-dark-switch>
<light-dark-switch enable-sync></light-dark-switch>
<light-dark-switch disabled></light-dark-switch>
Documents
Properties
|Property Name|Document| |:--|:--| |enable-sync|使按钮在html的dark类名变更后同步| |selected|使按钮在首次渲染后的选择状态为已选择(selected),它会被html的实际类名影响| |disabled|使按钮不可用|
Methods
|Method|Returns| |:--|--:| |select()|void| |unSelect()|void| |enableSync()|void| |disableSync()|void| |isSelected()|boolean| |isDisabled()|boolean| |isSync()|boolean|