ankurk91 / vue-bootstrap-datetimepicker

Vue.js component for eonasdan bootstrap datetimepicker
MIT License
223 stars 66 forks source link

Can't make it work as a component #13

Closed atleta closed 7 years ago

atleta commented 7 years ago

I'm submitting a ... (check one with "x")

[ X] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

Current behavior Adding it as a component (inside a component file) and it doesn't work. An empty input box shows up, but that's it. Here's the exception I see on the console:

TypeError: t.datetimepicker is not a function
Stack trace:
mounted@webpack-internal:///239:1:1791
callHook@webpack-internal:///3:2702:9
insert@webpack-internal:///3:3589:7
invokeInsertHook@webpack-internal:///3:5542:9
patch@webpack-internal:///3:5745:5
lifecycleMixin/Vue.prototype._update@webpack-internal:///3:2461:16
updateComponent@webpack-internal:///3:2575:7
get@webpack-internal:///3:2918:13
run@webpack-internal:///3:2995:17
flushSchedulerQueue@webpack-internal:///3:2761:5
queueNextTick/<@webpack-internal:///3:699:11
nextTickHandler@webpack-internal:///3:646:7

Expected behavior Should work as described in the documentation

Minimal reproduction of the problem with instructions Follow the documentation.

atleta commented 7 years ago

Here's the exception trace as it's reported by vue:


[Vue warn]: Error in mounted hook: "TypeError: t.datetimepicker is not a function"

found in

---> <DatePicker>
       <XEditorDialog> at src/components/XEditorDialog.vue
         <X> at src/components/XEditor.vue
           <App> at src/App.vue
             <Root>
ankurk91 commented 7 years ago

@atleta Believe you are using webpack, if so you need to adjust your webpack.config.js file

https://github.com/ankurk91/vue-bootstrap-datetimepicker/blob/93bd5b55ff70526c660a42c05c6e9d565eb1454d/webpack.config.dev.js#L71-L77

Similar #5

ankurk91 commented 7 years ago

@atleta Closing due to no activity. Feel free to re-open.

atleta commented 6 years ago

That was quick ;). But yep, thanks, you were right, it solved the problem. And after your response, I found it in the README as well. The reason I missed it, is because I think the README is a bit illogical here. First it explains how to use it, and then it talks about the installation steps.

I think you should swap these, to make it easier for newcomers.