Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 计算属性多次运行nuxtjs_Vue.js_Memory Leaks_Nuxt.js_Computed Properties - Fatal编程技术网

Vue.js 计算属性多次运行nuxtjs

Vue.js 计算属性多次运行nuxtjs,vue.js,memory-leaks,nuxt.js,computed-properties,Vue.js,Memory Leaks,Nuxt.js,Computed Properties,我正在用NuxtJS构建一个相对较大的web应用程序(但这个问题是关于Vue的) 我有一个主页,其中包含许多面板,以v-for呈现 要呈现的列表是依赖于许多数据值的计算属性的结果: services(){ console.log(“服务”) 常数基=[ { 标题:“Novitá”, id:‘circolari’, 颜色:“#1A2B63”, sync:this.sync.circolare, 组件:()=>导入(“~/components/one\u use\u component/circol

我正在用NuxtJS构建一个相对较大的web应用程序(但这个问题是关于Vue的)

我有一个主页,其中包含许多面板,以v-for呈现

要呈现的列表是依赖于许多数据值的计算属性的结果:

services(){
console.log(“服务”)
常数基=[
{
标题:“Novitá”,
id:‘circolari’,
颜色:“#1A2B63”,
sync:this.sync.circolare,
组件:()=>导入(“~/components/one\u use\u component/circolari\u list”),
道具:{
错误:this.error.circolare,
isShowingCircolari:this.isShowingCircolari&&this.showCircolari
}
},
{
id:“orario”,
颜色:“#FD4F19”,
同步:空,
组件:()=>导入(“~/components/one\u use\u component/orario\u today”),
道具:{
今天:今天
}
},
{
id:‘sondaggi’,
btn:this.$auth.loggedIn&&this.$auth.user.scope>1?'Sondaggi':false,
颜色:'#556080',
sync:this.sync.sondaggi,
组件:()=>导入(“~/components/one\u use\u component/sondaggi\u available”),
添加:this.$auth.loggedIn&&this.$auth.user.scope>1?“/sondaggi/admin/add”:false,
道具:{
错误:this.error.sondaggi
}
},
{
id:'特伦尼',
btn:错,
颜色:“#BD392A”,
sync:this.sync.treni,
修改:'/treni',
组件:()=>导入(“~/components/one\u use\u component/my\u train”),
道具:{
错误:this.error.treni,
Isshowinganda:这个,Isshowinganda
}
},
{
id:‘giornalino’,
颜色:'#B0C4D9',
sync:this.sync.giornalino,
组件:()=>导入(“~/components/one\u use\u component/last\u articles”),
道具:{
错误:this.error.giornalino
}
}
]
返回此。$auth.loggedIn&&this。$auth.user.isValidated
?base.filter(s=>!(this.$store.state.general.services.unused.indexOf(s.id)!==-1)).sort((a,b)=>this.$store.state.general.services.order.indexOf(a.id)-this.$store.state.general.services.order.indexOf(b.id))
:base.slice(0,1)
}
在引导阶段,我调用更新sync和error对象的方法,这使得整个computed属性在每次引导时运行多次(大约6-7次)。 我怎样才能使它更有效率?将
导入
放在里面会导致内存泄漏或其他什么