質問するログイン新規登録

回答編集履歴

1

typescriptで試したのを載せておく

2019/11/27 03:28

投稿

rururu3
rururu3

スコア5545

answer CHANGED
@@ -51,4 +51,35 @@
51
51
  }
52
52
  }
53
53
  </script>
54
- ```
54
+ ```
55
+
56
+ ---
57
+ **追記**
58
+ ---
59
+
60
+ `vue/cli`でvue.js+typescriptプロジェクト作って結局こうなった
61
+ main.ts
62
+ ```ts
63
+ import Vue from 'vue';
64
+ import App from './App.vue';
65
+ import router from './router';
66
+ import store from './store';
67
+
68
+ // tslint:disable-next-line:no-var-requires
69
+ const VCalendar = require('v-calendar');
70
+ // v-calendarのlib.jsにあるinstall関数そのまま持ってくる
71
+ const defaults = VCalendar.setupCalendar({});
72
+ Object.keys(VCalendar).forEach((k) =>
73
+ Vue.component(`${defaults.componentPrefix}${k}`, VCalendar[k]),
74
+ );
75
+
76
+ Vue.config.productionTip = false;
77
+
78
+ new Vue({
79
+ router,
80
+ store,
81
+ render: (h) => h(App),
82
+ }).$mount('#app');
83
+ ```
84
+
85
+ ※import使った際のError出てても結局は動くっぽい…typeエラーとして出してるだけかも