Reputation: 11
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
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