ankurk91 / vue-bootstrap-datetimepicker

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

Error "t.datetimepicker is not a function" #5

Closed archer3cl closed 7 years ago

archer3cl 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 Plugin is not working on module environment, console shows Error "t.datetimepicker is not a function"

Expected behavior Plugin should show on module environment

Minimal reproduction of the problem with instructions Clean installation in webpack module.

// at app.js
import moment from 'moment';
import datePicker from 'vue-bootstrap-datetimepicker';
import 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css';
Vue.use(datePicker);

const app = new Vue({
    el: '#app',
    components: {
        datePicker
    }
    data: function(){
      return { testdate: moment() }
    }
});
// at index.html
<body>
    <div id="app">
             <date-picker v-model="testdate"></date-picker>
        </div>
</body>

error in console image

ankurk91 commented 7 years ago

Are you sure you have jQuery installed ?

Tip When you specify -

Vue.use(datePicker);

It means you are registering a global component, so you no need to specify local component.

I have setup a jsfiddle demo for you - https://jsfiddle.net/ankurk91/zupazg2u/4/

You can also take a look at examples and my webpack.config Possibly it webpack configuration issue.

Screenshot was not sufficient, can you please share a sample repo or setup a webpackbin?

archer3cl commented 7 years ago

After testing at webpackbin i can implement your plugin without trouble. Maybe is as you say a webpack configuration issue

ankurk91 commented 7 years ago

May be this can fix this -> https://github.com/ankurk91/vue-bootstrap-datetimepicker/blob/master/webpack.config.dev.js#L71-L75 Feel free to re-open :smile:

chansovann commented 6 years ago

Hi @ankurk91 it not work for me also it show me some error like this " Uncaught ReferenceError: datePicker is not defined".

chansovann commented 6 years ago

i'm already import all this in my app.js import datePicker from 'vue-bootstrap-datetimepicker'; import 'bootstrap/dist/css/bootstrap.css'; import 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css'; Vue.use(datePicker);

ankurk91 commented 6 years ago

@TholthoeunChansovann Have you configured webpack ?

chansovann commented 6 years ago

@ankurk91 yes already i configured on webpage.mix.js

ankurk91 commented 6 years ago

Thats strange, it would be helpful if you can share a minimal reproduction of the issue on a github repo.

chansovann commented 6 years ago

i try use all this code on app.js import datePicker from 'vue-bootstrap-datetimepicker'; import 'bootstrap/dist/css/bootstrap.css'; import 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css'; Vue.use(datePicker);

and use this code at other components

ankurk91 commented 6 years ago

Sorry, This wont help.

chansovann commented 6 years ago

@ankurk91 Thank for help now it work.