+477
-572
lines changedFilter options
+477
-572
lines changed Original file line number Diff line number Diff line change
@@ -3,20 +3,17 @@
3
3
<date-picker v-model="date" :date-class="dateClass" />
4
4
</div>
5
5
</template>
6
-
<script>
7
-
export default {
8
-
data() {
9
-
return {
10
-
date: null,
11
-
};
12
-
},
13
-
methods: {
14
-
dateClass(date) {
15
-
return date.getDay() === 0 ? 'btn-sunday' : '';
16
-
},
17
-
},
18
-
};
6
+
7
+
<script setup>
8
+
import { ref } from 'vue';
9
+
10
+
const date = ref(null);
11
+
12
+
function dateClass(d) {
13
+
return d.getDay() === 0 ? 'btn-sunday' : '';
14
+
}
19
15
</script>
16
+
20
17
<style lang="less">
21
18
.uiv .btn-sunday.btn-default,
22
19
.uiv .btn-sunday.btn-primary {
Original file line number Diff line number Diff line change
@@ -17,12 +17,8 @@
17
17
</dropdown>
18
18
</form>
19
19
</template>
20
-
<script>
21
-
export default {
22
-
data() {
23
-
return {
24
-
date: null,
25
-
};
26
-
},
27
-
};
20
+
<script setup>
21
+
import { ref } from 'vue';
22
+
23
+
const date = ref(null);
28
24
</script>
Original file line number Diff line number Diff line change
@@ -8,12 +8,8 @@
8
8
>
9
9
</section>
10
10
</template>
11
-
<script>
12
-
export default {
13
-
data() {
14
-
return {
15
-
date: null,
16
-
};
17
-
},
18
-
};
11
+
<script setup>
12
+
import { ref } from 'vue';
13
+
14
+
const date = ref(null);
19
15
</script>
Original file line number Diff line number Diff line change
@@ -8,12 +8,8 @@
8
8
>
9
9
</section>
10
10
</template>
11
-
<script>
12
-
export default {
13
-
data() {
14
-
return {
15
-
date: null,
16
-
};
17
-
},
18
-
};
11
+
<script setup>
12
+
import { ref } from 'vue';
13
+
14
+
const date = ref(null);
19
15
</script>
Original file line number Diff line number Diff line change
@@ -3,18 +3,14 @@
3
3
<date-picker v-model="date" :limit-from="limitFrom" :limit-to="limitTo" />
4
4
</div>
5
5
</template>
6
-
<script>
7
-
export default {
8
-
data() {
9
-
const today = new Date();
10
-
const nextWeek = new Date();
11
-
nextWeek.setDate(nextWeek.getDate() + 7);
6
+
<script setup>
7
+
import { ref } from 'vue';
12
8
13
-
return {
14
-
date: null,
15
-
limitFrom: today,
16
-
limitTo: nextWeek,
17
-
};
18
-
},
19
-
};
9
+
const date = ref(null);
10
+
11
+
const today = new Date();
12
+
const nextWeek = new Date();
13
+
nextWeek.setDate(nextWeek.getDate() + 7);
14
+
const limitFrom = ref(today);
15
+
const limitTo = ref(nextWeek);
20
16
</script>
Original file line number Diff line number Diff line change
@@ -8,12 +8,8 @@
8
8
>
9
9
</section>
10
10
</template>
11
-
<script>
12
-
export default {
13
-
data() {
14
-
return {
15
-
date: null,
16
-
};
17
-
},
18
-
};
11
+
<script setup>
12
+
import { ref } from 'vue';
13
+
14
+
const date = ref(null);
19
15
</script>
Original file line number Diff line number Diff line change
@@ -3,12 +3,8 @@
3
3
<date-picker v-model="date" :week-starts-with="1" />
4
4
</div>
5
5
</template>
6
-
<script>
7
-
export default {
8
-
data() {
9
-
return {
10
-
date: null,
11
-
};
12
-
},
13
-
};
6
+
<script setup>
7
+
import { ref } from 'vue';
8
+
9
+
const date = ref(null);
14
10
</script>
Original file line number Diff line number Diff line change
@@ -3,12 +3,8 @@
3
3
<date-picker v-model="date" :today-btn="false" :clear-btn="false" />
4
4
</div>
5
5
</template>
6
-
<script>
7
-
export default {
8
-
data() {
9
-
return {
10
-
date: null,
11
-
};
12
-
},
13
-
};
6
+
<script setup>
7
+
import { ref } from 'vue';
8
+
9
+
const date = ref(null);
14
10
</script>
Original file line number Diff line number Diff line change
@@ -109,4 +109,3 @@ Name | Type | Default | Requir
109
109
`year-month-formatter` | Function | | | The formatter function of year month label string on top of date view, with 2 params `year` and `month` (0-based), with the formatted string returned.
110
110
`icon-control-left` | String | glyphicon glyphicon-chevron-left | | The arrow icon shown inside the `previous` button.
111
111
`icon-control-right` | String | glyphicon glyphicon-chevron-right | | The arrow icon shown inside the `next` button.
112
-
`locale` | Object | | | The locale used for translating month and weekday names, clear-btn and today-btn texts.
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
1
1
import newLocale from '../../locale/lang/zh-CN';
2
-
import {
3
-
createWrapper,
4
-
nextTick,
5
-
sleep,
6
-
triggerEvent,
7
-
} from '../../__test__/utils';
8
-
import { RouterLinkStub } from '@vue/test-utils';
9
-
import DatePicker from './DatePicker';
2
+
import { createWrapper, nextTick, triggerEvent } from '../../__test__/utils';
10
3
11
4
describe('DatePicker.vue', () => {
12
5
let wrapper;
@@ -32,8 +25,7 @@ describe('DatePicker.vue', () => {
32
25
}
33
26
);
34
27
await nextTick();
35
-
expect(wrapper.vm.$refs.datepicker.currentMonth).toEqual(7);
36
-
expect(wrapper.vm.$refs.datepicker.currentYear).toEqual(1991);
28
+
expect(wrapper.find('.uiv-datepicker-title').text()).toEqual('1991 August');
37
29
});
38
30
39
31
it('should be able to render custom year month str', async () => {
@@ -422,45 +414,4 @@ describe('DatePicker.vue', () => {
422
414
const sundayBtn = dateView.findAll('.btn-sunday');
423
415
expect(sundayBtn.length).toEqual(6);
424
416
});
425
-
426
-
it('should be able to use locale for custom translations', async () => {
427
-
const wrapper = createWrapper(
428
-
`<section>
429
-
<date-picker :locale="locale" v-model="date"/>
430
-
</section>`,
431
-
{
432
-
date: null,
433
-
locale: newLocale,
434
-
}
435
-
);
436
-
const locale = newLocale.uiv.datePicker;
437
-
await nextTick();
438
-
const picker = wrapper.findAll('[data-role="date-picker"]')[0];
439
-
expect(picker).toBeDefined();
440
-
const dateView = picker.findAll('table')[0];
441
-
const yearMonthBtn = dateView.find(
442
-
'thead tr:first-child td:nth-child(2) button'
443
-
);
444
-
const now = new Date();
445
-
expect(yearMonthBtn.text()).toContain(locale[`month${now.getMonth() + 1}`]);
446
-
const weekdays = dateView.findAll('thead tr:last-child td');
447
-
const weekdayNames = [];
448
-
for (let i = 0; i < weekdays.length; i++)
449
-
weekdayNames.push(weekdays[i].text());
450
-
const { week1, week2, week3, week4, week5, week6, week7 } = locale;
451
-
expect(weekdayNames).toEqual([
452
-
week7,
453
-
week1,
454
-
week2,
455
-
week3,
456
-
week4,
457
-
week5,
458
-
week6,
459
-
]);
460
-
const { today, clear } = locale;
461
-
const todayBtn = picker.find('.text-center .btn-info');
462
-
expect(todayBtn.text()).toEqual(today);
463
-
const clearBtn = picker.find('.text-center .btn-default');
464
-
expect(clearBtn.text()).toEqual(clear);
465
-
});
466
417
});
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4