[Improvement] Field: add is-link prop (#1347)

This commit is contained in:
neverland 2018-06-28 17:46:58 +08:00 committed by GitHub
parent 19d1c45121
commit 7d97a2fd85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 1 deletions

View File

@ -125,6 +125,7 @@ Field support all native properties of input tagsuch as `maxlength`、`placeh
| autosize | Textarea auto resizecan accpet an object, e.g. { maxHeight: 100, minHeight: 50 } | `Boolean | Object` | `false` |
| icon | Right side icon name | `String` | - |
| left-icon | Left side icon name | `String` | - |
| is-link | Whether to show link icon | `Boolean` | `false` |
### Event

View File

@ -4,6 +4,7 @@
:title="label"
:center="center"
:border="border"
:is-link="isLink"
:required="required"
:class="b({
error,
@ -68,6 +69,7 @@ export default create({
label: String,
error: Boolean,
center: Boolean,
isLink: Boolean,
leftIcon: String,
required: Boolean,
clearable: Boolean,

View File

@ -127,6 +127,7 @@ Field 默认支持 Input 标签所有的原生属性,比如 `maxlength`、`pla
| autosize | 自适应内容高度,只对 textarea 有效,可传入对象,如 { maxHeight: 100, minHeight: 50 },单位为 px | `Boolean | Object` | `false` |
| icon | 输入框尾部图标 (可选值见 Icon 组件) | `String` | - |
| left-icon | 输入框左侧图标 (可选值见 Icon 组件) | `String` | - |
| is-link | 是否展示右侧箭头并开启点击反馈 | `Boolean` | `false` |
### Event

View File

@ -1,6 +1,14 @@
import List from '..';
import { mount, later } from '../../../test/utils';
function mockOffsetParent(el) {
Object.defineProperty(el, 'offsetParent', {
get() {
return {};
}
});
}
test('load event', async() => {
const wrapper = mount(List);
@ -8,6 +16,8 @@ test('load event', async() => {
wrapper.vm.loading = value;
});
mockOffsetParent(wrapper.vm.$el);
await later();
expect(wrapper.emitted('load')).toBeTruthy();
expect(wrapper.emitted('input')).toBeTruthy();
@ -26,6 +36,8 @@ test('finished', async() => {
}
});
mockOffsetParent(wrapper.vm.$el);
await later();
expect(wrapper.emitted('load')).toBeFalsy();
expect(wrapper.emitted('input')).toBeFalsy();

View File

@ -18,10 +18,11 @@
border: 0;
margin: 0;
padding: 0;
display: block;
width: 100%;
resize: none;
display: block;
box-sizing: border-box;
background-color: transparent;
&:disabled {
opacity: 1;