From c3cf60e6565d1996bcddaa376f010f7b820d84f7 Mon Sep 17 00:00:00 2001 From: yutent Date: Mon, 7 Aug 2023 18:55:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Readme.md | 2 +- src/form/checkbox.js | 1 - src/form/index.js | 1 - src/form/passwd.js | 14 ++++++-------- src/form/select.js | 24 ++---------------------- 5 files changed, 9 insertions(+), 33 deletions(-) diff --git a/Readme.md b/Readme.md index f25cf86..133227a 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # @bd/ui -百搭 UI 组件库, 基于 `web components` 开发。面向下一代的 UI 组件库 +百搭 UI 组件库, 基于 [【wkit】](https://github.com/bytedo/wkit) 开发。面向下一代的 UI`web components` 组件库 ![downloads](https://img.shields.io/npm/dt/@bd/ui.svg) ![version](https://img.shields.io/npm/v/@bd/ui.svg) diff --git a/src/form/checkbox.js b/src/form/checkbox.js index 5d25e62..7dec373 100644 --- a/src/form/checkbox.js +++ b/src/form/checkbox.js @@ -12,7 +12,6 @@ class Checkbox extends Component { value: { type: Array, default: [], - attribute: false, observer() { this.#updateChildrenStat() } diff --git a/src/form/index.js b/src/form/index.js index fd46019..77f2e3e 100644 --- a/src/form/index.js +++ b/src/form/index.js @@ -1,6 +1,5 @@ import './button.js' import './checkbox.js' -import './dropdown.js' import './input.js' import './link.js' import './number.js' diff --git a/src/form/passwd.js b/src/form/passwd.js index 6f4889c..c1abc7a 100644 --- a/src/form/passwd.js +++ b/src/form/passwd.js @@ -16,11 +16,6 @@ class Passwd extends Component { default: '', attribute: false }, - _type: { - type: String, - default: 'password', - attribute: false - }, autofocus: false, readonly: false, disabled: false, @@ -189,6 +184,8 @@ class Passwd extends Component { ` ] + #type = 'password' + mounted() { if (this.autofocus) { nextTick(_ => this.$refs.input.focus()) @@ -199,7 +196,8 @@ class Passwd extends Component { if (this.readOnly || this.disabled) { return } - this._type = this._type === 'password' ? '' : 'password' + this.#type = this.#type === 'password' ? '' : 'password' + this.$requestUpdate() } handleInput(ev) { @@ -221,13 +219,13 @@ class Passwd extends Component { @change=${this.handleChange} :readOnly=${this.readOnly} :disabled=${this.disabled} - :type=${this._type} + :type=${this.#type} :value=${this.value} /> ` diff --git a/src/form/select.js b/src/form/select.js index f24d926..56694f7 100644 --- a/src/form/select.js +++ b/src/form/select.js @@ -8,6 +8,8 @@ import { nextTick, css, html, Component } from 'wkit' import '../icon/index.js' import '../form/input.js' import '../scroll/index.js' +import '../option/index.js' + class Select extends Component { static props = { value: { @@ -88,26 +90,4 @@ class Select extends Component { } } -class Option extends Component { - static props = { - value: '2' - } - - static styles = [css``] - - mounted() { - // console.log(this.value) - // console.log(this.$refs) - // console.log(this.root.innerHTML) - console.log('option mounted') - } - onclick() { - console.log(11) - } - render() { - return html`
${this.value}
` - } -} - Select.reg('select') -Option.reg('option')