Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

still valid with vue #7

Open
robbiemu opened this issue Mar 15, 2017 · 5 comments
Open

still valid with vue #7

robbiemu opened this issue Mar 15, 2017 · 5 comments

Comments

@robbiemu
Copy link

robbiemu commented Mar 15, 2017

I'm getting:

vue.runtime.esm.js?a427:563 [Vue warn]: Failed to mount component: template or render function not defined. 
(found in <Datepicker>)

here's my package.json dependencies:

  "dependencies": {
    "@websanova/vue-auth": "^2.8.2-beta",
    "axios": "^0.15.3",
    "vee-validate": "^2.0.0-beta.25",
    "vue": "^2.1.10",
    "vue-axios": "^2.0.1",
    "vue-material-datepicker": "^2.0.1",
    "vue-router": "^2.2.0",
    "vue-server-renderer": "^2.1.10",
    "vuetify": "^0.8.9",
    "vuex": "^2.1.2",
    "vuex-router-sync": "^4.1.2"
  },

and I mount it with:

<template>
  <!-- stufff and: -->
  <div name="dob"><datepicker orientation="landscape" /></div>
</template>
<script>
import Datepicker from 'vue-material-datepicker'

function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

export default {
  props: ['crud', 'id'],
  components: { datepicker: Datepicker },

ps> I tried aliasing in vue: 'vue/dist/vue.js' in my webpack config and it is still breaking

@bastienGranger
Copy link
Owner

Hi,
Try this to import Datepicker

Vue.component('Datepicker', require('vue-material-datepicker/src/Datepicker.vue'));

@robbiemu
Copy link
Author

I did try that but it had issues finding its dependencies, both external and in the src directory. But if that would work, or not, the main one should work either with vue or vue/dist/vue if you ask me

@ArnoldGitHub
Copy link

I have the exact same issue, @robbiemu , do you have solution yet?

@Levgenij
Copy link

Levgenij commented Mar 18, 2017

same problem.
And need to fix readme:
$ npm install vue-material-datepicker instead $ npm install vue-datepicker

@robbiemu
Copy link
Author

robbiemu commented Mar 18, 2017

@ArnoldGitHub no actually I moved on. I can get it to load but the calendar doesn't look right.

To load it:
1 import the source component:

  import DatePicker from 'vue-material-datepicker/src/Datepicker.vue'

2 set up your project to handle scss as a style language specification. In your webpack config, add options to your .vue file handler, to conform to the pattern:

  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
        // vue-loader options
          loaders: {
            scss: 'style-loader!css-loader!sass-loader'
          }
        }
      },
...

Optionally, also support .scss files while you're there:

      {
        test: /\.scss$/,
        loader: ['style-loader', 'css-loader', 'sass-loader']
      }
  1. you may need to npm i -D node-sass, but I think all the current templates have it now.
  2. npm i -S moment moment-range too
  3. notice that the input appears, but the calendar doesnt / or looks completely wrong.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants