Compare commits

...

2 Commits

Author SHA1 Message Date
neverland
8a97278cda
docs: update features (#9727) 2021-10-26 16:36:16 +08:00
neverland
ddc0e09b69
chore: using Event constructor instead of initEvent (#9723)
* chore: using Event constructor instead of initEvent

* types: fix onChange
2021-10-26 10:56:11 +08:00
7 changed files with 49 additions and 54 deletions

View File

@ -27,16 +27,17 @@
## Features
- 65+ Reusable components
- 1kb Component average size (min+gzip)
- 90%+ Unit test coverage
- Extensive documentation and demos
- Support Vue 2 & Vue 3
- Support Tree Shaking
- Support Custom Theme
- Support i18n
- Support TS
- Support SSR
- 🚀 1KB Component average size (min+gzip)
- 🚀 65+ High quality components
- 💪 90%+ Unit test coverage
- 💪 Written in TypeScript
- 📖 Extensive documentation and demos
- 📖 Provide Sketch and Axure design resources
- 🍭 Support Vue 2 & Vue 3
- 🍭 Support Tree Shaking
- 🍭 Support Custom Theme
- 🍭 Support i18n
- 🌍 Support SSR
## Install

View File

@ -31,16 +31,17 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源
## 特性
- 提供 60 多个高质量组件,覆盖移动端各类场景
- 性能极佳,组件平均体积不到 1kbmin+gzip
- 单元测试覆盖率 90%+,提供稳定性保障
- 完善的中英文文档和示例
- 支持 Vue 2 & Vue 3
- 支持按需引入
- 支持主题定制
- 支持国际化
- 支持 TypeScript
- 支持 SSR
- 🚀 性能极佳,组件平均体积小于 1KBmin+gzip
- 🚀 65+ 个高质量组件,覆盖移动端主流场景
- 💪 使用 TypeScript 编写,提供完整的类型定义
- 💪 单元测试覆盖率超过 90%,提供稳定性保障
- 📖 提供完善的中英文文档和组件示例
- 📖 提供 Sketch 和 Axure 设计资源
- 🍭 支持 Vue 2、Vue 3 和微信小程序
- 🍭 支持主题定制,内置 700+ 个主题变量
- 🍭 支持按需引入和 Tree Shaking
- 🍭 支持服务器端渲染
- 🌍 支持国际化和语言包定制
## 安装

View File

@ -8,16 +8,17 @@
### Features
- 65+ Reusable components
- 1kb Component average size (min+gzip)
- 90%+ Unit test coverage
- Extensive documentation and demos
- Support Vue 2 & Vue 3
- Support Tree Shaking
- Support Custom Theme
- Support i18n
- Support TS
- Support SSR
- 🚀 1KB Component average size (min+gzip)
- 🚀 65+ High quality components
- 💪 90%+ Unit test coverage
- 💪 Written in TypeScript
- 📖 Extensive documentation and demos
- 📖 Provide Sketch and Axure design resources
- 🍭 Support Vue 2 & Vue 3
- 🍭 Support Tree Shaking
- 🍭 Support Custom Theme
- 🍭 Support i18n
- 🌍 Support SSR
### Quickstart

View File

@ -18,16 +18,17 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源
### 特性
- 提供 60 多个高质量组件,覆盖移动端各类场景
- 性能极佳,组件平均体积不到 1kbmin+gzip
- 单元测试覆盖率 90%+,提供稳定性保障
- 完善的中英文文档和示例
- 支持 Vue 2 & Vue 3
- 支持按需引入
- 支持主题定制
- 支持国际化
- 支持 TypeScript
- 支持 SSR
- 🚀 性能极佳,组件平均体积小于 1KBmin+gzip
- 🚀 65+ 个高质量组件,覆盖移动端主流场景
- 💪 使用 TypeScript 编写,提供完整的类型定义
- 💪 单元测试覆盖率超过 90%,提供稳定性保障
- 📖 提供完善的中英文文档和组件示例
- 📖 提供 Sketch 和 Axure 设计资源
- 🍭 支持 Vue 2、Vue 3 和微信小程序
- 🍭 支持主题定制,内置 700+ 个主题变量
- 🍭 支持按需引入和 Tree Shaking
- 🍭 支持服务器端渲染
- 🌍 支持国际化和语言包定制
### 快速上手

View File

@ -1,6 +1,5 @@
import { HTMLAttributes, InputHTMLAttributes } from 'vue';
import {
trigger,
isObject,
isPromise,
isFunction,
@ -50,15 +49,14 @@ export function getRuleMessage(value: unknown, rule: FieldRule) {
return message || '';
}
export function startComposing(event: Event) {
event.target!.composing = true;
export function startComposing({ target }: Event) {
target!.composing = true;
}
export function endComposing(event: Event) {
const { target } = event;
export function endComposing({ target }: Event) {
if (target!.composing) {
target!.composing = false;
trigger(target as Element, 'input');
target!.dispatchEvent(new Event('input'));
}
}

View File

@ -1,6 +1,5 @@
import { createApp } from 'vue';
import { later } from '../../../test';
import { trigger } from '../../utils';
import { Notify } from '../function-call';
import NotifyComponent from '../Notify';
@ -65,6 +64,6 @@ test('should call onClick option when clicked', async () => {
await later();
const notify = document.querySelector('.van-notify');
trigger(notify, 'click');
notify.click();
expect(onClick).toHaveBeenCalledTimes(1);
});

View File

@ -66,12 +66,6 @@ export function preventDefault(event: Event, isStopPropagation?: boolean) {
}
}
export function trigger(target: Element, type: string) {
const inputEvent = document.createEvent('HTMLEvents');
inputEvent.initEvent(type, true, true);
target.dispatchEvent(inputEvent);
}
export function isHidden(
elementRef: HTMLElement | Ref<HTMLElement | undefined>
) {