import { Attributes, Component, vm } from 'jinge'; import { registerFocus, deregisterFocus } from '../_util'; import _tpl from './button.html'; const IGNORED_EVENTS = ['touchstart', 'mousedown']; export interface ButtonAttrs { to?: string; target?: '_self' | '_blank'; href?: string; active?: string; type?: 'button' | 'submit'; disabled?: boolean; ripple?: boolean; } export class Button extends Component { static template = _tpl; to?: string; target?: '_self' | '_blank'; href?: string; active?: string; type: 'button' | 'submit'; disabled: boolean; ripple: boolean; rippleActive: | false | { _event: Event; }; hasFocus: boolean; _tag: 'sref' | 'a' | 'button'; _ts: number; constructor(attrs: Attributes) { super(attrs); this._tag = attrs.to ? 'sref' : attrs.href ? 'a' : 'button'; this.to = attrs.to || ''; this.target = attrs.target || '_self'; this.href = attrs.href || ''; this.active = attrs.active; this.type = attrs.type || 'button'; this.disabled = attrs.disabled; this.ripple = attrs.ripple !== false; this.rippleActive = false; this.hasFocus = false; /** * 在移动设备上,同一次的 Touch,