Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property or method "mesh" is not defined #20

Open
sylwesterdigital opened this issue Jul 7, 2020 · 1 comment
Open

Property or method "mesh" is not defined #20

sylwesterdigital opened this issue Jul 7, 2020 · 1 comment

Comments

@sylwesterdigital
Copy link

Apologies if this is low level question but I have a Vue project and I would like to implement your module to use ThreeJS inside. What I have done

  1. I placed to my main.js
import * as VueThreejs from 'vue-threejs' // >= 0.2.0
Vue.use(VueThreejs)
  1. I've created Test.vue
<template>
  <renderer :size="{ w: 600, h: 400 }">
    <scene>
      <camera :position="{ z: 15 }"></camera>
      <mesh :obj="mesh" :position="{ y: -200 }"></mesh>
      <animation :fn="animate" :speed="3"></animation>
    </scene>
  </renderer>
</template>

<script>


  export default {
    data() {
      return {
        test: "test from data"
      }
    },
    methods: {},
    components: {}
  }
</script>

<style scoped>
</style>

In chrome console I have errors:

[Vue warn]: Property or method "mesh" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. S

and infinite times iterations error:

VueThreejs.common.js:5259 Uncaught TypeError: this.fn is not a function
    at VueComponent.begin

To be honest I have no idea how to use your module. Can you advice what is missing?

@fritx
Copy link
Owner

fritx commented Jul 10, 2020

@sylwesterdigital hi, this is Vue-level stuffs..

If being referenced, mesh, fn should be defined in their Vue instances like

export default {
  data () {
    return {
      mesh: new THREE.Mesh(geometry, material)  // Three.js-level stuffs
      fn: () => { console.log(1) }
    }
  }
}

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

No branches or pull requests

2 participants