gfddd1231
gfddd1231

Reputation: 11

How to make vue set not to monitor data

I used webgl in vue and found that the data written in the return will constantly monitor the scene, resulting in poor performance。

before:

data(){
   return{
       //I create a new variable here
   }
}

after: (I'm not sure if writing this will make vue not listen to variables)

data(){
    //I create a new variable here
    return {}
}

Upvotes: 1

Views: 36

Answers (1)

Hans Felix Ramos
Hans Felix Ramos

Reputation: 4434

You can create outside data and access it by $options, like $options.myVar on your template.

export default{
  myVar : 'var',
  data(){   
    return {}
  }
}

Upvotes: 1

Related Questions