0.1.3 • Published 3 years ago

calendar-framework v0.1.3

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

カレンダー例

Vue.js用のカレンダー作成用ライブラリ。 下記機能搭載。

  • 高さ、幅、色など各デザインカスタマイズ可能。
  • 各日付のマスに、ユーザが作成したテンプレート構文を挿入可能。

Installation

npm install calendar-framewoek
# or
yarn add calendar-framework

Usage

Example

<template>
  <div>
    <div>
      <button @click="() => $refs.calendar.prev()">◀ Prev</button>
      <button @click="() => $refs.calendar.next()">Next ▶</button>
    </div>
    <Calendar
      ref="calendar"
      outsideDateColor="rgb(70,70,70)"
      itemMinWidth="290px"
      itemMaxWidth="290px"
      itemMinHeight="200px"
      itemMaxHeight="200px"
      weekFontSize="40px"
      weekdayColor="white"
      dateColor="white"
      dateFontSize="24px"
      borderStyle="double"
      borderWidth="6px"
      borderColor="white"
      todayBorderColor="yellow"
      backgroundColor="black"
    >
      <template
        v-for="element in [4, 5, 11, 12, 18, 19, 20, 24, 25, 26]"
        v-slot:[element]
      >
        <div :key="element">
          <p style="color: white; color: red">休暇</p>
        </div>
      </template>
      <template v-slot:default style="color: white">
        <p style="color: white">やることリスト</p>
        <input type="text" />
        <input type="text" />
        <input type="text" />
        <button>決定</button>
      </template>
    </Calendar>
  </div>
</template>

<script>
import Calendar from "calendar-framework";

export default {
  components: {
    Calendar,
  },
};
</script>

v-model

現在の日付のDate型の値を返す。

<Calendar v-model="currentDate">

Props

NameTypeDefaultDetail
yearNumber現在日時の年。取得したいカレンダーの年。
monthNumber現在日時の月。取得したいカレンダーの月。
weekHeightString"60px"カレンダーの曜日部分の各マスの高さ。
itemMinHeightString"0"カレンダーの日付部分の各マスの最小の高さ。※高さを固定にしたい場合、「itemMaxHeight」にも同じ値を入れる。
itemMaxHeightString"auto"カレンダーの日付部分の各マスの最大の高さ。※高さを固定にしたい場合、「itemMinHeight」にも同じ値を入れる。
itemMinWidthString"0"カレンダーの日付部分の各マスの最小の幅。※幅を固定にしたい場合、「itemMaxWidth」にも同じ値を入れる。
itemMaxWidthString"auto"カレンダーの日付部分の各マスの最大の幅。※幅を固定にしたい場合、「itemMinWidth」にも同じ値を入れる。
outsideDateColorString"gray"カレンダーの最初と最後の、該当月外の日付部分の色。
weekNamesArray "SUN", "MON", "TUE", "WED", "THU", "FRY", "SAT"カレンダーの曜日部分の表示内容。日曜日から順に配列に入れる。null値を入れた箇所には、デフォルトの表示で置き換えられる。
saturdayColorString"blue"カレンダーの曜日の「土曜日」に該当する文字のフォント色。
sundayColorString"red"カレンダーの曜日の「日曜日」に該当する文字のフォント色。
weekdayColorString"black"カレンダーの曜日の「土曜日」、「日曜日」以外に該当する文字のフォント色。
weekFontSizeString"26px"カレンダーの曜日の文字のフォントサイズ。
dateColorString"black"カレンダーの日付の文字のフォント色。
dateFontSizeString"16px"カレンダーの日付の文字のフォントサイズ。
borderColorString"black"カレンダーの線の色。
borderStyleString"double"カレンダーの線のスタイル。
borderWidthString"4px"カレンダーの線の幅。
todayBorderColorString-現在の日付が表示月の中にあれば、指定した色で囲む。本プロパティを未設定の場合、現在の日付があっても、囲まれない。
backgroundColorString"transparent"カレンダー全体の背景色。

Template insertion

<Calendar>
    <template v-slot: ##設定したい日付## >
        ##設定するテンプレート##
    </template>
</Calendar>

複数設定する場合

<Calendar>
    <template
        v-for="element in [##設定する日付の配列##]"
        v-slot:[element]
        >
        <div :key="element">
            ##設定するテンプレート##
        </div>
    </template>
</Calendar>

デフォルトを設定する場合

<Calendar>
    <template v-slot:default>
        ##設定するテンプレート##
    </template>
</Calendar>

To next month or previous month

<button @click=() => $refs.calendar.prev()>◀ prev</button>
<button @click=() => $refs.calendar.next()>next ▶</button>
<Calendar ref="calendar">
0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago