0.1.0 • Published 1 year ago

light-dark-switch v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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 NameDocument
enable-sync使按钮在html的dark类名变更后同步
selected使按钮在首次渲染后的选择状态为已选择(selected),它会被html的实际类名影响
disabled使按钮不可用

Methods

MethodReturns
select()void
unSelect()void
enableSync()void
disableSync()void
isSelected()boolean
isDisabled()boolean
isSync()boolean
0.1.0

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago