1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Vue.componentを使用したグローバルコンポーネントにて、propsを設定する方法

Last updated at Posted at 2019-12-16

はじめに

Vue.componentを使用したグローバルコンポーネントにて、propsを設定したいと思って調べた結果の備忘録です

vueのバージョン

$ yarn list vue
yarn list v1.19.1
warning Filtering by arguments is deprecated. Please use the pattern option instead.
├─ vue-ctk-date-time-picker@2.4.0
│  └─ vue@2.6.11
└─ vue@2.6.10
✨  Done in 0.91s.

コード

vue-ctk-date-time-pickerをグローバルコンポーネントで定義した例です

import Vue from 'vue'
import DateTimePicker from 'vue-ctk-date-time-picker'
import 'vue-ctk-date-time-picker/dist/vue-ctk-date-time-picker.css'

Vue.component('date-time-picker', {
  extends: DateTimePicker,
  props: {
    label: {
      default: ''
    },
    minuteInterval: {
      default: 30
    },
    format: {
      default: 'YYYY-MM-DD HH:mm:00'
    },
    overlay: {
      default: true
    },
    noButtonNow: {
      default: true
    }
  }
})

参考

vue-ctk-date-time-picker
Passing Props in Global Components in Vue Ask

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?