Vue-material: some theme error

Created on 16 Dec 2016  路  10Comments  路  Source: vuematerial/vue-material

vue.js?3de6:2643 [Vue warn]: Error when rendering component <md-sidenav>: 
warn @ vue.js?3de6:2643
Vue._render @ vue.js?3de6:2255
(anonymous) @ vue.js?3de6:1699
get @ vue.js?3de6:740
run @ vue.js?3de6:809
flushSchedulerQueue @ vue.js?3de6:627
nextTickHandler @ vue.js?3de6:405
vue.js?3de6:2264 TypeError: Cannot read property 'currentTheme' of undefined
    at VueComponent.themeClass (eval at <anonymous> (app.js:1246), <anonymous>:1:986)
    at Watcher.get (eval at <anonymous> (app.js:610), <anonymous>:740:27)
    at Watcher.evaluate (eval at <anonymous> (app.js:610), <anonymous>:848:21)
    at Proxy.computedGetter (eval at <anonymous> (app.js:610), <anonymous>:1310:15)
    at Proxy.render (eval at <anonymous> (app.js:1246), <anonymous>:15:19271)
    at VueComponent.Vue._render (eval at <anonymous> (app.js:610), <anonymous>:2252:22)
    at VueComponent.eval (eval at <anonymous> (app.js:610), <anonymous>:1699:21)
    at Watcher.get (eval at <anonymous> (app.js:610), <anonymous>:740:27)
    at Watcher.run (eval at <anonymous> (app.js:610), <anonymous>:809:22)
    at Array.flushSchedulerQueue (eval at <anonymous> (app.js:610), <anonymous>:627:13)
    at nextTickHandler (eval at <anonymous> (app.js:610), <anonymous>:405:16)

I upgraded to v5, and updated code to use new theme API

bug documentation

Most helpful comment

Fixed! Was a problem on Vue Material instance affecting only non commonjs env. To fix I had to expose the instance inside Vue instances as well. No breaking changes though:

this.$material.setCurrentTheme('about')

Sorry about this ugly bug!

All 10 comments

+1 Same error when updating to v5 and updated theme API.

I think this is related to :
Vue.material.currentTheme, in the MdTheme mixin : see here
But I don't see why Vue.material wouldn't be initialized when the App renders.

Hi, everyone!
which Vue version do you use? I play with Vue version on codepen and get error on 2.1.6/2.1.5 version:

Uncaught TypeError: t._h is not a function
at o.render (VM308 vue-material.js:9)
at o.n._render (VM130 vue.min.js:6)
at o. (VM130 vue.min.js:6)
at Pi.get (VM130 vue.min.js:7)
at new Pi (VM130 vue.min.js:7)
at o.e._mount (VM130 vue.min.js:6)
at o.Ie.$mount (VM130 vue.min.js:8)
at o.Ie.$mount (VM130 vue.min.js:8)
at fe (VM130 vue.min.js:6)
at s (VM130 vue.min.js:6)

On 2.1.4 vue-material works

Same error here !
Vue Version 2.1.5

I had same error when migrate to 0.5.0, Vue version 2.1.0

Uncaught TypeError: Cannot read property 'currentTheme' of undefined

same error in [email protected] && [email protected]
when I write like below

<template lang="pug">
  .body-container
    router-view
</template>

I got the error like this
image

By the way I came across another error with code below

<template lang="pug">
  .body-container
    md-theme(md-name='default')
      router-view
</template>

This may due to the vue-router, which replace the router-view with other elements.

When I write like this

<template lang="pug">
  .body-container
    md-theme(md-name='default')
      div
        router-view
</template>

It turns back to the very first problem again.
TypeError: Cannot read property 'currentTheme' of undefined

Same as above with [email protected] && [email protected]

However I can draw a card by putting md-theme in all subcomponents

I'm checking that. I'm sorry about this!

Same error! but still render the md-whiteframe for some reason

Already found the problem. Working on it!

Fixed! Was a problem on Vue Material instance affecting only non commonjs env. To fix I had to expose the instance inside Vue instances as well. No breaking changes though:

this.$material.setCurrentTheme('about')

Sorry about this ugly bug!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bjarnik picture bjarnik  路  3Comments

philipfeldmann picture philipfeldmann  路  3Comments

tridcatij picture tridcatij  路  3Comments

andreujuanc picture andreujuanc  路  3Comments

korylprince picture korylprince  路  3Comments