给prompt-dialog添加type属性

This commit is contained in:
wurou 2022-12-01 10:33:46 +08:00
parent b7f64eef43
commit eafe4f07c4
1 changed files with 6 additions and 3 deletions

View File

@ -1,8 +1,10 @@
import { import {
customElement, customElement,
html, html,
ifDefined,
nothing, nothing,
query, query,
property,
CSSResultArray, CSSResultArray,
TemplateResult, TemplateResult,
} from '@star-web-components/base/star-base-element.js' } from '@star-web-components/base/star-base-element.js'
@ -35,7 +37,8 @@ export class StarPromptDialog extends StarBaseDialog {
} }
// 暴露给外部使用 // 暴露给外部使用
@query('input') public promptInput!: HTMLInputElement @query('input') public promptInput!: HTMLInputElement
@property({type: String}) type!: string
@property({type: Number}) maxlength!: number
public static override get styles(): CSSResultArray { public static override get styles(): CSSResultArray {
return [super.styles, promptDialogStyles] return [super.styles, promptDialogStyles]
} }
@ -57,10 +60,10 @@ export class StarPromptDialog extends StarBaseDialog {
: nothing} : nothing}
<div class="star-prompt-main"> <div class="star-prompt-main">
<input <input
type="text" type=${ifDefined(this.type)}
value="${this.value}" value="${this.value}"
class="star-prompt-input" class="star-prompt-input"
maxlength="10" maxlength=${ifDefined(this.maxlength)}
/> />
<star-button <star-button
id="delete" id="delete"