[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` | | autosize | Textarea auto resizecan accpet an object, e.g. { maxHeight: 100, minHeight: 50 } | `Boolean | Object` | `false` |
| icon | Right side icon name | `String` | - | | icon | Right side icon name | `String` | - |
| left-icon | Left side icon name | `String` | - | | left-icon | Left side icon name | `String` | - |
| is-link | Whether to show link icon | `Boolean` | `false` |
### Event ### Event

View File

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

View File

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

View File

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

View File

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