3.0.1 • Published 3 years ago

mpvue-calendar v3.0.1

Weekly downloads
423
License
MIT
Repository
github
Last release
3 years ago

A feature-rich calendar component, support multiple modes and gesture sliding. For vue 3.0+

💻 Install

mpvue-calendar only support vue@3.0+

npm i mpvue-calendar -S

🔨 Usage

<Calendar
  backgroundText
  class-name="select-mode"
  :remarks="remarks"
/>

import { ref } from 'vue'
import Calendar from 'mpvue-calendar'

export default {
  components: {
    Calendar,
  },
  setup() {
    const remarks = ref({'2021-1-13': 'some tings'})

    return {
      remarks,
    }
  }
}

⚙️ API

nametypedefaultdescription
selectModeString'select'For the selection mode of calendar component, can be used by 'select', 'multi','range', 'multiRange' mode
modeString'month'Configure calendar display mode, the modes has 'month', 'week','monthRange'
selectDateString / String[] / {start: String; end: String} / {start: String; end: String} []In different selection modes, there are use different types. String type for select mode, String[] type for multi mode, {start: String; end: String} type for range mode, and {start: String; end: String} [] type for multiRange mode.
monthRangeString[]If you use monthRange mode, you need to set the content of the month to be displayed. for example [2021-1, 2021-2, 2021-6, 2021-9]
remarksObjectCreate remark for a day, key is date string, and value is remark content. for example { '2021-1-13': 'some things' }
tileContentObjectCreate tile content for a day, key is date string, and value is object, object have className and content. for example { '2021-1-5': { className: 'tip-class', content: 'some tip' } }
holidaysObjectCustom holiday information, for example {'2021-1-1': 'New Year'}
completionBooleanfalseComplete the calendar table with 6 lines
useSwipeBooleantrueThe mobile terminal supports gesture sliding to switch calendar
arrowLeftStringLeft arrow image url of toolbar
arrowRightStringRight arrow image url of toolbar
monFirstBooleanfalseThe first day of the week begins on Monday
backgroundTextBooleanfalseDisplays the background text of the current month calendar
languageStringuse 'en' or 'cn' language
format(year, month) => String, StringFormat the date display at the header. you need return a array, the contents of the array are year and month
weeksString[]Weekly display content of custom header, for example 'S', 'M', 'T', 'W', 'T', 'F', 'S'
beginStringSet the available date of the start, and the date before it will be disabled, for example '2021-1-5'
endStringSet the available date of the end, and the date after it will be disabled, for example '2021-2-5'
disabledString[]Disable certain dates , for example ['2021-1-9', '2021-2-5']

Chinese lunar

If you need show chinese lunar, you need import lunar module.

<Calendar
  :lunar="lunar"
/>

import lunar from 'mpvue-calendar/dist/lunar'
export default {
  ...,
  setup() {
    return {
      lunar,
    }
  }
}

⚙️ methods

nametypedescription
onSelect(selectDate) => voidThis function is triggered when the date is selected
onMonthChange(year, month, day) => voidThe callback is triggered when the month is change
next(year, month) => voidCallback this method when triggered next month
prev(year, month) => voidCallback this method when triggered prev month
setTodayref methodBack today, you need to pass the ref parameter to call the internal method
3.0.1

3 years ago

3.0.0

3 years ago

3.0.0-beta

3 years ago

2.3.6

4 years ago

2.3.7

4 years ago

2.3.5

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago

2.3.2

4 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.13

5 years ago

2.0.12

5 years ago

2.0.11

5 years ago

2.0.10

5 years ago

2.0.9

5 years ago

2.0.8

5 years ago

2.0.7

5 years ago

2.0.6

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.4.0

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago