Merge remote-tracking branch 'main/dev' into dev

This commit is contained in:
陈嘉涵 2017-08-18 14:47:19 +08:00
commit 87e211cabf
7 changed files with 49 additions and 6 deletions

View File

@ -1,5 +1,12 @@
## 更新日志
## [v0.8.0](https://github.com/youzan/vant/tree/v0.8.0) (2017-08-17)
[Full Changelog](https://github.com/youzan/vant/compare/v0.7.10...v0.8.0)
**合并的 Pull Request (可能有不兼容改动):**
- Optimize component building, reduce dist file size [\#74](https://github.com/youzan/vant/pull/74) ([chenjiahan](https://github.com/chenjiahan))
## [v0.7.10](https://github.com/youzan/vant/tree/v0.7.10) (2017-08-16)
[Full Changelog](https://github.com/youzan/vant/compare/v0.7.8...v0.7.10)

View File

@ -47,7 +47,15 @@ export default {
:on-icon-click="onIconClick"
@blur="onFieldBlur"
required></van-field>
<van-field type="password" label="密码:" placeholder="请输入密码" required></van-field>
<van-field
type="password"
label="密码:"
placeholder="请输入密码"
required>
<template slot="icon">
<van-icon name="search"></van-icon>
</template>
</van-field>
<van-field type="textarea" label="个人介绍:" placeholder="请输入个人介绍" required></van-field>
</van-cell-group>
```
@ -132,3 +140,9 @@ export default {
| icon | 输入框尾部图标 | `string` | | icon中支持的类型 |
| onIconClick | 点击图标的回调函数 | `function` | | |
### Slot
| name | 描述 |
|-----------|-----------|
| icon | 自定义icon |

View File

@ -1,6 +1,6 @@
{
"name": "vant",
"version": "0.8.0",
"version": "0.8.1",
"description": "有赞vue wap组件库",
"main": "lib/vant.js",
"style": "lib/vant-css/index.css",

View File

@ -9,7 +9,8 @@
'van-field--disabled': disabled,
'van-field--error': error,
'van-field--border': border,
'van-field--autosize': autosize
'van-field--autosize': autosize,
'van-field--has-icon': showIcon
}">
<textarea
v-if="type === 'textarea'"
@ -37,7 +38,11 @@
:maxlength="maxlength"
:disabled="disabled"
:readonly="readonly">
<van-icon v-if="icon && currentValue" :name="icon" class="van-field__icon" @click="onIconClick"></van-icon>
<div v-if="showIcon" class="van-field__icon" @click="onIconClick">
<slot name="icon">
<van-icon :name="icon"></van-icon>
</slot>
</div>
</van-cell>
</template>
@ -101,6 +106,17 @@ export default {
}
},
computed: {
showIcon() {
// iconslot
if (this.$slots.icon) {
return true;
}
return this.icon && this.currentValue;
}
},
methods: {
handleInput(event) {
this.currentValue = event.target.value;

View File

@ -37,7 +37,7 @@ import Swipe from './swipe';
import SwipeItem from './swipe-item';
import DatetimePicker from './datetime-picker';
const version = '0.8.0';
const version = '0.8.1';
const components = [
Button,
Switch,

View File

@ -1,6 +1,6 @@
{
"name": "vant-css",
"version": "0.8.0",
"version": "0.8.1",
"description": "vant css.",
"main": "lib/index.css",
"style": "lib/index.css",

View File

@ -78,6 +78,12 @@
}
}
&--has-icon {
.van-field__control {
width: 90%;
}
}
&__control {
border: 0;
font-size: 14px;