【发布时间】:2017-02-19 08:37:38
【问题描述】:
我的看法是这样的:
<div class="row no-gutter">
<div class="col-md-9 col-xs-12">
<div class="wrap-tabs">
<ul class="nav nav-tabs nav-cat">
<li role="presentation" class="active"><a href="#" data-toggle="tab">England</a></li>
<li role="presentation"><a href="#" data-toggle="tab">Spain</a></li>
<li role="presentation"><a href="#" data-toggle="tab">Italy</a></li>
</ul>
</div>
</div>
</div>
<br>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active">
<top-player-view country_id="1"></top-player-view>
</div>
</div>
我的组件顶部播放器视图是这样的:
<template>
...
</template>
<script>
export default{
props:['country_id'],
created() {
this.$store.dispatch('getTopPlayers', this.country_id)
}
}
</script>
例如,当我单击西班牙选项卡时,它会像这样调用 country_id = 2 的组件 top-player-view
<top-player-view country_id="2"></top-player-view>
当我点击 italy 选项卡时,它会像这样调用 country_id = 3 的组件 top-player-view
<top-player-view country_id="3"></top-player-view>
组件数据是否通过每个选项卡选择的 ajax 加载?或者怎么做?
请帮忙
【问题讨论】:
标签: javascript vue.js vuejs2 vue-component vuex