mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-14 01:31:06 +08:00
Compare commits
No commits in common. "8a97278cda1f35ab6e75ea4317a3a270fd52b4fc" and "ca1aa1a7b1534d784a558d87e36cac2154476f1e" have entirely different histories.
8a97278cda
...
ca1aa1a7b1
21
README.md
21
README.md
@ -27,17 +27,16 @@
|
||||
|
||||
## Features
|
||||
|
||||
- 🚀 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
|
||||
- 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
|
||||
|
||||
## Install
|
||||
|
||||
|
||||
@ -31,17 +31,16 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源
|
||||
|
||||
## 特性
|
||||
|
||||
- 🚀 性能极佳,组件平均体积小于 1KB(min+gzip)
|
||||
- 🚀 65+ 个高质量组件,覆盖移动端主流场景
|
||||
- 💪 使用 TypeScript 编写,提供完整的类型定义
|
||||
- 💪 单元测试覆盖率超过 90%,提供稳定性保障
|
||||
- 📖 提供完善的中英文文档和组件示例
|
||||
- 📖 提供 Sketch 和 Axure 设计资源
|
||||
- 🍭 支持 Vue 2、Vue 3 和微信小程序
|
||||
- 🍭 支持主题定制,内置 700+ 个主题变量
|
||||
- 🍭 支持按需引入和 Tree Shaking
|
||||
- 🍭 支持服务器端渲染
|
||||
- 🌍 支持国际化和语言包定制
|
||||
- 提供 60 多个高质量组件,覆盖移动端各类场景
|
||||
- 性能极佳,组件平均体积不到 1kb(min+gzip)
|
||||
- 单元测试覆盖率 90%+,提供稳定性保障
|
||||
- 完善的中英文文档和示例
|
||||
- 支持 Vue 2 & Vue 3
|
||||
- 支持按需引入
|
||||
- 支持主题定制
|
||||
- 支持国际化
|
||||
- 支持 TypeScript
|
||||
- 支持 SSR
|
||||
|
||||
## 安装
|
||||
|
||||
|
||||
@ -8,17 +8,16 @@
|
||||
|
||||
### Features
|
||||
|
||||
- 🚀 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
|
||||
- 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
|
||||
|
||||
### Quickstart
|
||||
|
||||
|
||||
@ -18,17 +18,16 @@ Vant 是**有赞前端团队**开源的移动端组件库,于 2017 年开源
|
||||
|
||||
### 特性
|
||||
|
||||
- 🚀 性能极佳,组件平均体积小于 1KB(min+gzip)
|
||||
- 🚀 65+ 个高质量组件,覆盖移动端主流场景
|
||||
- 💪 使用 TypeScript 编写,提供完整的类型定义
|
||||
- 💪 单元测试覆盖率超过 90%,提供稳定性保障
|
||||
- 📖 提供完善的中英文文档和组件示例
|
||||
- 📖 提供 Sketch 和 Axure 设计资源
|
||||
- 🍭 支持 Vue 2、Vue 3 和微信小程序
|
||||
- 🍭 支持主题定制,内置 700+ 个主题变量
|
||||
- 🍭 支持按需引入和 Tree Shaking
|
||||
- 🍭 支持服务器端渲染
|
||||
- 🌍 支持国际化和语言包定制
|
||||
- 提供 60 多个高质量组件,覆盖移动端各类场景
|
||||
- 性能极佳,组件平均体积不到 1kb(min+gzip)
|
||||
- 单元测试覆盖率 90%+,提供稳定性保障
|
||||
- 完善的中英文文档和示例
|
||||
- 支持 Vue 2 & Vue 3
|
||||
- 支持按需引入
|
||||
- 支持主题定制
|
||||
- 支持国际化
|
||||
- 支持 TypeScript
|
||||
- 支持 SSR
|
||||
|
||||
### 快速上手
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { HTMLAttributes, InputHTMLAttributes } from 'vue';
|
||||
import {
|
||||
trigger,
|
||||
isObject,
|
||||
isPromise,
|
||||
isFunction,
|
||||
@ -49,14 +50,15 @@ export function getRuleMessage(value: unknown, rule: FieldRule) {
|
||||
return message || '';
|
||||
}
|
||||
|
||||
export function startComposing({ target }: Event) {
|
||||
target!.composing = true;
|
||||
export function startComposing(event: Event) {
|
||||
event.target!.composing = true;
|
||||
}
|
||||
|
||||
export function endComposing({ target }: Event) {
|
||||
export function endComposing(event: Event) {
|
||||
const { target } = event;
|
||||
if (target!.composing) {
|
||||
target!.composing = false;
|
||||
target!.dispatchEvent(new Event('input'));
|
||||
trigger(target as Element, 'input');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { createApp } from 'vue';
|
||||
import { later } from '../../../test';
|
||||
import { trigger } from '../../utils';
|
||||
import { Notify } from '../function-call';
|
||||
import NotifyComponent from '../Notify';
|
||||
|
||||
@ -64,6 +65,6 @@ test('should call onClick option when clicked', async () => {
|
||||
|
||||
await later();
|
||||
const notify = document.querySelector('.van-notify');
|
||||
notify.click();
|
||||
trigger(notify, 'click');
|
||||
expect(onClick).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
@ -66,6 +66,12 @@ 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>
|
||||
) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user