Compare commits

...

11 Commits

Author SHA1 Message Date
neverland
45e7e15c2d
style(TreeSelect): allow select text in content slot (#10081) 2021-12-21 21:02:08 +08:00
neverland
4cc269c1f2
fix(PullRefresh): may trigger browser bounce in some cases (#10080) 2021-12-21 20:59:30 +08:00
chenjiahan
d68a3820aa docs(@vant/icons): changelog 1.7.3 2021-12-21 20:43:24 +08:00
chenjiahan
283b775d5f release: @vant/icons 1.7.3 2021-12-21 20:42:33 +08:00
neverland
b13e083964
fix(Icons): complete https protocol (#10079) 2021-12-21 20:40:19 +08:00
neverland
388e9f7546
style(PullRefresh): remove user-select: none (#10078) 2021-12-21 20:19:42 +08:00
neverland
a504a956af
Update contribution.zh-CN.md 2021-12-21 20:05:23 +08:00
chenjiahan
c52feebaf5 docs(@vant/icons): changelog v1.7.2 2021-12-21 20:01:11 +08:00
chenjiahan
36f8757df7 release: @vant/icons 1.7.2 2021-12-21 20:00:15 +08:00
neverland
dfc36962b0
docs(Icons): add contribution guide (#10077) 2021-12-21 19:57:51 +08:00
neverland
49ad4307bf
feat(Icons): add cash-o icon (#10076) 2021-12-21 19:54:42 +08:00
14 changed files with 2042 additions and 35 deletions

View File

@ -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

View File

@ -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

View 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。
发布完成后,在对应仓库中进行升级,即可使用新图标。

View File

@ -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",

View File

@ -973,3 +973,7 @@
.van-icon-guide-o:before {
content: '\e74c';
}
.van-icon-cash-o:before {
content: '\e74d';
}

View File

@ -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

View File

@ -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');
}

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -9,7 +9,6 @@
.van-pull-refresh {
overflow: hidden;
user-select: none;
&__track {
position: relative;

View File

@ -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 });
}
}

View File

@ -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 {