VUEX 这是我所有的积分了

hu18359 2018-01-10 05:28:28
父组件详情页

<style lang="less">
@import '../../../styles/common.less';
@import 'service.less';
@import '../count-to/count-to.less';
</style>
<template>
<div>
<Card>
<Tabs id="detail">
<TabPane label="概述" icon="social-apple">
<index></index>
</TabPane>
<TabPane label="监控" icon="social-windows" id="monitor">
<monitor></monitor>
</TabPane>
<TabPane label="日志" icon="calendar" id="log">
<log></log>
</TabPane>
<TabPane label="扩容" icon="social-tux" id="scala">
<scala ></scala>
</TabPane>

<TabPane label="存储" icon="archive">
<storage></storage>
</TabPane>
<TabPane label="端口" icon="ios-cloud">
<port></port>
</TabPane>
<TabPane label="设置" icon="gear-b">
<setting></setting>
</TabPane>
</Tabs>
</Card>
</div>
</template>
<script>
import CountTo from '../count-to/CountTo.vue'
import monitor from './components/detail/monitor.vue'
import setting from './components/detail/setting.vue'
import scala from './components/detail/scala.vue'
import storage from './components/detail/storage.vue'
import port from './components/detail/port.vue'
import log from './components/detail/log.vue'
import index from './components/detail/index.vue'
import apis from '@/api/apis'
import util from '@/libs/util'
import {mapState,mapActions} from 'vuex';
export default {
components:{
monitor:monitor,
log:log,
scala:scala,
monitor:monitor,
setting:setting,
port:port,
storage:storage,
CountTo:CountTo,
index:index,
},
data () {
return {
param:{
id:'',
uid:1
},
}
},
}
</script>



子组件

computed:{
memory:{
get(){
return this.test = this.deploy.pods[0].spec.containers[0].resources.requests.memory.toString();
},
set(value){
this.test = value;
},
},
...mapState(['deploy'])
},
created(){
this.scalaccolumns = tableData.scalaccolumns;
this.param.id = this.$route.query.serviceId;
this.$store.dispatch('querypodData',this.param);
}



问题描述:
这是个子组件,包含在详情页的组件下,在由列表页进入详情页的时候,computed被调用了2次,这是为什么,不是computed不是在created之后才会被调用的吗?
...全文
265 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复

87,903

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧