<tap-pat-editor>

单字段编辑页,交互参考 iOS 设置中编辑名称。适合从设置行进入编辑名称、简介等。

值改变后(设置 required 时还需非空)完成按钮才可用,点击完成或回车后只发出 change,返回或关闭由调用方处理。

Example

配合设置页

从 tap-pat-settings 的行进入,保存后返回。

import { html } from '@mantou/gem/lib/element';
import { Stack } from '@mantou/tap-ui/elements/stack';

import '@mantou/tap-ui/patterns/editor';

const editName = () => {
  Stack.push({
    gesture: true,
    content: html`
      <tap-pat-editor
        heading="名称"
        back
        required
        value=${name}
        @change=${(evt) => {
          name = evt.detail;
          Stack.pop();
        }}
      ></tap-pat-editor>
    `,
  });
};

API

单字段编辑页,例如设置中的名称、简介

点击完成或回车后只发出 change,关闭或返回由调用方处理

Extends GemElement

Instance Properties

Property(Attribute) Reactive Type Description
heading(heading) Yes string
value(value) Yes string
placeholder(placeholder) Yes string
description(description) Yes string Note below the input, e.g. what the value is used for
type(type) Yes TapInputElement['type']
back(back) Yes boolean Show the back button of the navbar, pops the closest stack
required(required) Yes boolean Disable done while the value is blank
change Emitter<string>

Other

Type Value
Event change