0.1.18 • Published 3 years ago

vue-notation v0.1.18

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

vue-notation

vue GitHub stars npm GitHub issues license

NPM

Example


Install

npm install vue-notation --save

# or
yarn add vue-notation

Global Registration

import Vue from 'vue'
import VueNotation from 'vue-notation'
import 'vue-notation/dist/vue-notation.css'

Vue.use(VueNotation)

Local Registration

import { VueNotation } from 'vue-notation'
import 'vue-notation/dist/vue-notation.css'

export default {
  components: {
    VueNotation
  }
}

CDN

<link rel="stylesheet" href="https://unpkg.com/vue-notation/dist/vue-notation.css"/>
<script type="text/javascript" src="path/to/vue.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/vue-notation/dist/vue-notation.umd.min.js"></script>

<div id="app">
    <vue-notation v-model="currentDate" :mode.sync="mode">
    </vue-notation>
</div>
<script type="text/javascript">
  new Vue({
      el: '#app',
      data: {
          mode: 'month',
          currentDate: new Date()
      }
  })
</script>

Usage

Basic Usage

<vue-mob-cal v-model="currentDate" :mode.sync="mode" color="#007873" />
export default {
  data() {
    return {
      currentDate: new Date(),
      mode: 'month'
    }
  }
}

Custom Slot

<vue-mob-cal v-model="currentDate" :mode.sync="mode">
  <template #left>
    <span>LeftBtn</span>
  </template>
  <template #right>
    <span>RightBtn</span>
  </template>
  <template #title>
    <span>Title</span>
  </template>
  <template #week="props">
    <span>周{{ props.day | week }}</span>
  </template>
  <template #day="props">
    <span v-if="props.util.isToday(props.date)">今</span>
    <span v-else>{{ props.date.getDate() }}</span>
    <!-- A dot will appear at the bottom -->
    <span v-if="props.date.getDay() === 1" class="mindot" style="background-color: red;"></span>
    <span v-if="props.date.getDay() === 6" class="mindot"></span>
    <!-- If you want to display the background, you have to configure this -->
    <span class="dot"></span> 
  </template>
</vue-mob-cal>
export default {
  data() {
    return {
      currentDate: new Date(),
      mode: 'month'
    }
  },
  filters: {
    week (day) {
      const days = ['一', '二', '三', '四', '五', '六', '日']
      day = day || 7
      return days[day - 1]
    }
  }
}

API

Props

AttributeDescriptionTypeDefault
valueCurrent calendar dateDatenew Date()
modeDisplay mode, support monthly or weekly display, params monthweekStringmonth
colorTheme colorString#007ad3

Slot

NameDescriptionSlotProps
titleCustom title { util: object }
weekCustom Week Title{ day: number } 0-6
leftCustom left icon-
rightCustom right icon-
dayCustom Calendar Item { date: date, util: object }
- utilCommon method{isToday: function, isWorkDay: function, isOtherMonth: function, isActiveDay: function, onPrev: function, onNext: function, onChangeMode: function}

Event

EventDescriptionArguments
onPrevChange to last month/week-
onNextChange to next month/week-
onChangeModeToggles display mode or set display modemode:!string

Changelog

Detailed changes for each release are documented in the release notes.

License

MIT

0.1.17

3 years ago

0.1.18

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.1.14

3 years ago

0.1.15

3 years ago

0.1.16

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago