Skip to content

Commit b0f5719

Browse files
author
baojie
committed
1 parent 3c79915 commit b0f5719

File tree

3 files changed

+30
-88
lines changed

3 files changed

+30
-88
lines changed

components/input/__tests__/index.test.js

-13
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ describe('Input', () => {
1111
focusTest(TextArea);
1212
focusTest(Password);
1313

14-
it('should support maxLength', async () => {
15-
const wrapper = mount(Input, { attrs: { maxLength: 3 }, sync: false });
16-
await asyncExpect(() => {
17-
expect(wrapper.html()).toMatchSnapshot();
18-
}, 0);
19-
});
2014
it('select()', () => {
2115
const wrapper = mount(Input);
2216
wrapper.vm.select();
@@ -62,13 +56,6 @@ describe('TextArea', () => {
6256
expect(wrapper.html()).toMatchSnapshot();
6357
});
6458
});
65-
66-
it('should support maxLength', async () => {
67-
const wrapper = mount(TextArea, { attrs: { maxLength: 10 }, sync: false });
68-
await asyncExpect(() => {
69-
expect(wrapper.html()).toMatchSnapshot();
70-
});
71-
});
7259
});
7360

7461
describe('As Form Control', () => {

components/input/inputProps.js

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export default {
3030
default: true,
3131
type: Boolean,
3232
},
33-
maxLength: PropTypes.number,
3433
loading: PropTypes.bool,
3534
className: PropTypes.string,
3635
};

examples/App.vue

+30-74
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,22 @@
11
<template>
2-
<a-config-provider :locale="locale">
3-
<div>
4-
<a-radio-group :value="locale" @change="changeLocale">
5-
<a-radio-button key="en" :value="enUS">
6-
English
7-
</a-radio-button>
8-
<a-radio-button key="cn" :value="zhCN">
9-
中文
10-
</a-radio-button>
11-
</a-radio-group>
12-
<div><h4>v-model: <input v-model="color" type="text"></h4><a-color-picker v-model="color" style="width:130px" @show="changeHandler" /></div>
13-
<div><h4>v-model:{{ color }}</h4><a-color-picker v-model="color" style="width:130px" @show="changeHandler" /></div>
14-
<div><h4>备选颜色</h4><a-color-picker :config="config1" /></div>
15-
<div><h4>多种输入格式</h4><a-color-picker :config="config2" :get-popup-container="node=>node.parentNode" /></div>
16-
<div>
17-
<button @click="config2.components.preview = !config2.components.preview">
18-
修改config
19-
</button>
20-
</div>
21-
<div><h4>多种尺寸</h4><a-color-picker size="large" /></div>
22-
<div><a-color-picker size="small" /></div>
23-
<div><h4>切换禁用</h4><a-color-picker :disabled="disabled" /></div>
24-
<div>
25-
<button @click="disabled = !disabled">
26-
切换
27-
</button>
28-
</div>
29-
<div><h4>切换格式 [color:{{ color2 }}]</h4><a-color-picker v-model="color2" :locale="zhCN" :format="format" /></div>
30-
<div>
31-
<button @click="format = 'HEX'">
32-
HEX
33-
</button>
34-
<button @click="format = 'RGBA'">
35-
RGBA
36-
</button>
37-
<button @click="format = 'HSVA'">
38-
HSVA
39-
</button>
40-
<button @click="format = 'HSLA'">
41-
HSLA
42-
</button>
43-
<button @click="format = 'CMYK'">
44-
CMYK
45-
</button>
46-
</div>
47-
</div>
48-
</a-config-provider>
2+
<input v-model="input" :maxlength="number" />
493
</template>
504

515
<script>
526
import enUS from 'ant-design-vue/../components/locale/en_US';
537
import zhCN from 'ant-design-vue/../components/locale/zh_CN';
548
export default {
559
name: 'Demo',
56-
data () {
10+
data() {
5711
return {
58-
color:'#ccc',
59-
color2:'#ccc',
60-
disabled:false,
61-
format:'',
12+
color: '#ccc',
13+
color2: '#ccc',
14+
disabled: false,
15+
format: '',
6216
locale: enUS,
6317
enUS,
6418
zhCN,
65-
config1:{
19+
config1: {
6620
swatches: [
6721
'rgba(244, 67, 54, 1)',
6822
'rgba(233, 30, 99, 0.95)',
@@ -78,35 +32,37 @@ export default {
7832
'rgba(205, 220, 57, 0.9)',
7933
'rgba(255, 235, 59, 0.95)',
8034
'rgba(255, 193, 7, 1)',
81-
],
35+
],
8236
},
83-
config2:{
37+
config2: {
8438
components: {
8539
// Main components
86-
preview: true,
87-
opacity: true,
88-
hue: true,
40+
preview: true,
41+
opacity: true,
42+
hue: true,
8943
interaction: {
90-
hex: true,
91-
rgba: true,
92-
hsla: true,
93-
hsva: true,
94-
cmyk: true,
95-
input: true,
96-
clear: true,
97-
save: true,
98-
},
99-
strings: {
100-
save: 'Save',
101-
clear: 'Clear',
102-
cancel: 'Cancel',
103-
},
44+
hex: true,
45+
rgba: true,
46+
hsla: true,
47+
hsva: true,
48+
cmyk: true,
49+
input: true,
50+
clear: true,
51+
save: true,
52+
},
53+
strings: {
54+
save: 'Save',
55+
clear: 'Clear',
56+
cancel: 'Cancel',
57+
},
10458
},
10559
},
60+
input: '',
61+
number: 10,
10662
};
10763
},
108-
methods:{
109-
changeHandler(...arg){
64+
methods: {
65+
changeHandler(...arg) {
11066
arg;
11167
// console.log(arg);
11268
},

0 commit comments

Comments
 (0)