nextcloud-libraries / nextcloud-vue

🍱 Vue.js components for Nextcloud app development ✌ https://npmjs.org/@nextcloud/vue
https://nextcloud-vue-components.netlify.app/
Other
214 stars 84 forks source link

[0.1.1] Datepicker "TypeError: Vue.use is not a function" #24

Closed dartcafe closed 6 years ago

dartcafe commented 6 years ago

Am I doing something wrong? When using the nc-datepicker I get a warning inside of the browser's console. [Vue warn]: Error in render: "TypeError: Vue.use is not a function"

When I change from import DatePicker from 'nextcloud-vue' to import DatePicker from 'vue2-datepicker' the datepicker works great.

My main.js:

import Vue from 'vue'
import Create from './Create.vue'
//import DatePicker from 'vue2-datepicker'
import DatePicker from 'nextcloud-vue'

Vue.component('DatePickerInput', DatePicker);

new Vue({
  el: '#create-poll',
  render: h => h(Create)
});

My Create.vue

<template>
    <div id="create-poll" class="flex-column">
        <date-picker-input placeholder="Expiration date" v-model="expire" ></date-picker-input>
    </div>
</template>

<script>
    export default {
        name: 'create-poll',

        data: function () {
            return {
            expire: '',
            }
        }
    }

</script>
skjnldsv commented 6 years ago

Hey :)

You need to use import {DatePicker} from 'nextcloud-vue'. Otherwise you're importing the whole package into the DatePicker variable ;)

skjnldsv commented 6 years ago

@dartcafe did it work? :)

dartcafe commented 6 years ago

@skjnldsv Umpf. no. When I change the line to import {DatePicker} from 'nextcloud-vue', I get the compiling error "export 'DatePicker' was not found in 'nextcloud-vue'

skjnldsv commented 6 years ago

@dartcafe ouuups, it's DatetimePicker :see_no_evil: https://github.com/nextcloud/vue-components/blob/8ef09ab40d65b6d0b7069b793746fd3554afa8ed/src/components/index.js#L25

dartcafe commented 6 years ago

OMG. :sunglasses: