mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] Field: add is-link prop (#1347)
This commit is contained in:
parent
19d1c45121
commit
7d97a2fd85
@ -125,6 +125,7 @@ Field support all native properties of input tag,such as `maxlength`、`placeh
|
|||||||
| autosize | Textarea auto resize,can accpet an object, e.g. { maxHeight: 100, minHeight: 50 } | `Boolean | Object` | `false` |
|
| autosize | Textarea auto resize,can 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
|
||||||
|
|
||||||
|
@ -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,
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user