Skip to content

Commit a8d3399

Browse files
committed
feat(calendar-view): add whether to display button properties on the mobile first
1 parent 39e0c6c commit a8d3399

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

examples/sites/demos/apis/calendar-view.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,20 @@ export default {
171171
mode: ['pc', 'mobile-first'],
172172
pcDemo: 'basic-usage',
173173
mfDemo: 'basic-usage'
174+
},
175+
{
176+
name: 'show-back-today',
177+
type: 'boolean',
178+
defaultValue: 'true',
179+
desc: {
180+
'zh-CN': '是否展示左上侧按钮显示,默认展示',
181+
'en-US': 'Should the upper left button be displayed, Default Display'
182+
},
183+
meta: {
184+
stable: '3.22.0'
185+
},
186+
mode: ['mobile-first'],
187+
mfDemo: 'calendar-mode'
174188
}
175189
],
176190
events: [

examples/sites/demos/mobile-first/app/calendar-view/calendar-mode.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<template>
2-
<tiny-calendar-view :events="eventslist" :year="2023" :month="6" :modes="['month', 'timeline', 'schedule']">
2+
<tiny-calendar-view
3+
:show-back-today="false"
4+
:events="eventslist"
5+
:year="2023"
6+
:month="6"
7+
:modes="['month', 'timeline', 'schedule']"
8+
>
39
</tiny-calendar-view>
410
</template>
511

examples/sites/demos/mobile-first/app/calendar-view/webdoc/calendar-view.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export default {
2222
},
2323
desc: {
2424
'zh-CN':
25-
'<p>通过 <code>mode</code> 属性指定以年的形式显示,将展示当年的每个月份。可选值有 <code>month</code> / <code>timeline</code> / <code>schedule</code>。</p>\n',
25+
'<p>通过 <code>mode</code> 属性指定以年的形式显示,将展示当年的每个月份。可选值有 <code>month</code> / <code>timeline</code> / <code>schedule</code>。通过<code>show-back-today</code> 属性控制左侧按钮显示。</p>\n',
2626
'en-US':
27-
'<p>The <code>mode</code> attribute specifies that each month of the current year is displayed. The options are <code>month</code> / <code>timeline</code> / <code>schedule</code>. </p>\n'
27+
'<p>The <code>mode</code> attribute specifies that each month of the current year is displayed. The options are <code>month</code> / <code>timeline</code> / <code>schedule</code>. Control the display of the left button through the<code>show back today</code>attribute.</p>\n'
2828
},
2929
codeFiles: ['calendar-mode.vue']
3030
},

packages/vue/src/calendar-view/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ export const calendarViewProps = {
7676
multiSelect: {
7777
type: Boolean,
7878
default: false
79+
},
80+
showBackToday: {
81+
type: Boolean,
82+
default: true
7983
}
8084
}
8185

packages/vue/src/calendar-view/src/mobile-first.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
</template>
2121
</tiny-tooltip>
2222
<div data-tag="tiny-calendar-view-today" class="flex justify-around items-center mb-3">
23-
<tiny-button @click="toToday">{{ t('ui.calendarView.backToday') }}</tiny-button>
23+
<tiny-button v-if="showBackToday" @click="toToday">{{ t('ui.calendarView.backToday') }}</tiny-button>
2424
<tiny-date-picker
2525
v-model="state.currentDate"
26-
class="ml-5 shrink-0"
26+
:class="[showBackToday ? 'ml-5' : '', 'shrink-0']"
2727
shape="filter"
2828
type="month"
2929
:clearable="false"
@@ -376,7 +376,8 @@ export default defineComponent({
376376
'events',
377377
'height',
378378
'mark-color',
379-
'multi-select'
379+
'multi-select',
380+
'showBackToday'
380381
],
381382
setup(props, context) {
382383
return setup({

0 commit comments

Comments
 (0)