mirror of
https://gitee.com/vant-contrib/vant.git
synced 2026-07-24 22:15:37 +08:00
Compare commits
11 Commits
c378b388c2
...
45e7e15c2d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45e7e15c2d | ||
|
|
4cc269c1f2 | ||
|
|
d68a3820aa | ||
|
|
283b775d5f | ||
|
|
b13e083964 | ||
|
|
388e9f7546 | ||
|
|
a504a956af | ||
|
|
c52feebaf5 | ||
|
|
36f8757df7 | ||
|
|
dfc36962b0 | ||
|
|
49ad4307bf |
@ -1,5 +1,13 @@
|
||||
## Changelog
|
||||
|
||||
## 1.7.3
|
||||
|
||||
- complete https protocol
|
||||
|
||||
## 1.7.2
|
||||
|
||||
- add cash-o icon
|
||||
|
||||
## 1.7.1
|
||||
|
||||
- add guide-o icon
|
||||
|
||||
@ -17,16 +17,3 @@ pnpm add @vant/icons
|
||||
|
||||
- [Usage in Vue](https://youzan.github.io/vant/#/zh-CN/icon)
|
||||
- [Usage in Weapp](https://youzan.github.io/vant-weapp/#/icon)
|
||||
|
||||
## Contribution
|
||||
|
||||
### Update Icons
|
||||
|
||||
1. Update assets/icons.sketch
|
||||
2. Make a Pull Request
|
||||
|
||||
### Add New Icon
|
||||
|
||||
1. Add new icon to assets/icons.sketch
|
||||
2. Add icon name to src/config.js
|
||||
3. Make a Pull Request
|
||||
|
||||
Binary file not shown.
47
packages/vant-icons/contribution.zh-CN.md
Normal file
47
packages/vant-icons/contribution.zh-CN.md
Normal file
@ -0,0 +1,47 @@
|
||||
# 图标贡献指南
|
||||
|
||||
## 设计稿
|
||||
|
||||
Vant 图标库托管在 [iconfont.cn](https://iconfont.cn) 上,同时仓库中保留了一份完整的 Sketch 设计稿。
|
||||
|
||||
[在线预览链接](https://iconfont.cn/collections/detail?cid=31945)
|
||||
|
||||
## 更新流程
|
||||
|
||||
新增/更新图标的标准流程如下:
|
||||
|
||||
### 1. 绘制图标
|
||||
|
||||
在 Sketch 中绘制所需的图标,并更新到 `assets/icons.sketch` 文件中。
|
||||
|
||||
绘制图标前,请阅读:[iconfont - 图标绘制](https://www.iconfont.cn/help/detail?spm=a313x.7781069.1998910419.16&helptype=draw)。
|
||||
|
||||
### 2. 上传图标
|
||||
|
||||
从 Sketch 中导出图标对应的 SVG 文件,并上传到 [iconfont 项目](https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=2553510)中。
|
||||
|
||||
<img src="https://img.yzcdn.cn/upload_files/2021/12/21/Fi0XXEorB1SVr_BT-Dz6txHOKNlB.png" style="width: 800px;">
|
||||
|
||||
> 此步骤需要图标库管理员权限,请联系 Vant 维护者进行添加。
|
||||
|
||||
### 3. 更新代码
|
||||
|
||||
在 iconfont 中将更新后的图标库下载到本地,并更新以下文件:
|
||||
|
||||
- `src/index.less`: 更新字体文件的 CDN 链接。
|
||||
- `src/encode-woff2.less`: 更新字体文件的 base64 URL。
|
||||
|
||||
如果有新增图标,还需要更新以下文件:
|
||||
|
||||
- `src/config.js`: 增加新图标的英文名称。
|
||||
- `src/common.less`: 增加新图标的样式类。
|
||||
|
||||
字体文件的 base64 URL 通过 [transfonter](https://transfonter.org/) 生成,步骤如下图所示:
|
||||
|
||||
<img src="https://img01.yzcdn.cn/upload_files/2021/12/21/FlMHanQNhDV1XWaw8spnAtHKumjW.png" style="width: 800px;">
|
||||
|
||||
### 4. 发布图标库
|
||||
|
||||
执行 `yarn release` 命令,发布 `@vant/icons` 到 npm。
|
||||
|
||||
发布完成后,在对应仓库中进行升级,即可使用新图标。
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vant/icons",
|
||||
"version": "1.7.1",
|
||||
"version": "1.7.3",
|
||||
"description": "vant icons",
|
||||
"main": "./src/config.js",
|
||||
"types": "./src/config.d.ts",
|
||||
|
||||
@ -973,3 +973,7 @@
|
||||
.van-icon-guide-o:before {
|
||||
content: '\e74c';
|
||||
}
|
||||
|
||||
.van-icon-cash-o:before {
|
||||
content: '\e74d';
|
||||
}
|
||||
|
||||
@ -149,6 +149,7 @@ export default {
|
||||
'shrink',
|
||||
'shield-o',
|
||||
'guide-o',
|
||||
'cash-o',
|
||||
],
|
||||
filled: [
|
||||
// has corresponding outline icon
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -5,10 +5,10 @@
|
||||
font-style: normal;
|
||||
font-display: auto;
|
||||
font-family: 'vant-icon';
|
||||
src: url('//at.alicdn.com/t/font_2553510_61agzg96wm8.woff2?t=1631948257467')
|
||||
src: url('https://at.alicdn.com/t/font_2553510_5imfhdc20ag.woff2?t=1640074908811')
|
||||
format('woff2'),
|
||||
url('//at.alicdn.com/t/font_2553510_61agzg96wm8.woff?t=1631948257467')
|
||||
url('https://at.alicdn.com/t/font_2553510_5imfhdc20ag.woff?t=1640074908811')
|
||||
format('woff'),
|
||||
url('//at.alicdn.com/t/font_2553510_61agzg96wm8.ttf?t=1631948257467')
|
||||
url('https://at.alicdn.com/t/font_2553510_5imfhdc20ag.ttf?t=1640074908811')
|
||||
format('truetype');
|
||||
}
|
||||
|
||||
1964
packages/vant-icons/yarn.lock
Normal file
1964
packages/vant-icons/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,12 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
const MIN_DISTANCE = 10;
|
||||
|
||||
type Direction = '' | 'vertical' | 'horizontal';
|
||||
|
||||
function getDirection(x: number, y: number) {
|
||||
if (x > y && x > MIN_DISTANCE) {
|
||||
if (x > y) {
|
||||
return 'horizontal';
|
||||
}
|
||||
if (y > x && y > MIN_DISTANCE) {
|
||||
if (y > x) {
|
||||
return 'vertical';
|
||||
}
|
||||
return '';
|
||||
@ -42,13 +40,19 @@ export function useTouch() {
|
||||
|
||||
const move = ((event: TouchEvent) => {
|
||||
const touch = event.touches[0];
|
||||
// Fix: Safari back will set clientX to negative number
|
||||
// safari back will set clientX to negative number
|
||||
deltaX.value = touch.clientX < 0 ? 0 : touch.clientX - startX.value;
|
||||
deltaY.value = touch.clientY - startY.value;
|
||||
offsetX.value = Math.abs(deltaX.value);
|
||||
offsetY.value = Math.abs(deltaY.value);
|
||||
|
||||
if (!direction.value) {
|
||||
// lock direction when distance is greater than a certain value
|
||||
const LOCK_DIRECTION_DISTANCE = 10;
|
||||
if (
|
||||
!direction.value ||
|
||||
(offsetX.value < LOCK_DIRECTION_DISTANCE &&
|
||||
offsetY.value < LOCK_DIRECTION_DISTANCE)
|
||||
) {
|
||||
direction.value = getDirection(offsetX.value, offsetY.value);
|
||||
}
|
||||
}) as EventListener;
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
|
||||
.van-pull-refresh {
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
|
||||
&__track {
|
||||
position: relative;
|
||||
|
||||
@ -290,16 +290,8 @@ export default defineComponent({
|
||||
if (props.touchable && state.swiping) {
|
||||
touch.move(event);
|
||||
|
||||
// if user starting to touchmove, prevent the event bubbling to
|
||||
// avoid affecting the parent components
|
||||
const shouldPrevent =
|
||||
isCorrectDirection.value ||
|
||||
touch.offsetY.value > touch.offsetX.value === props.vertical;
|
||||
if (shouldPrevent) {
|
||||
preventDefault(event, props.stopPropagation);
|
||||
}
|
||||
|
||||
if (isCorrectDirection.value) {
|
||||
preventDefault(event, props.stopPropagation);
|
||||
move({ offset: delta.value });
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
position: relative;
|
||||
display: flex;
|
||||
font-size: var(--van-tree-select-font-size);
|
||||
user-select: none;
|
||||
|
||||
&__nav {
|
||||
flex: 1;
|
||||
@ -24,6 +23,7 @@
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
&-item {
|
||||
user-select: none;
|
||||
padding: var(--van-tree-select-nav-item-padding);
|
||||
}
|
||||
}
|
||||
@ -40,6 +40,7 @@
|
||||
padding: 0 32px 0 var(--van-padding-md);
|
||||
font-weight: var(--van-font-weight-bold);
|
||||
line-height: var(--van-tree-select-item-height);
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
|
||||
&--active {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user