简体   繁体   English

Vue.js 组件不显示

[英]Vue.js component does not show up

I'm having difficulties understanding where the problem is.我很难理解问题出在哪里。

I have a component called PlayerTabs which has different tabs.我有一个名为PlayerTabs的组件,它有不同的选项卡。 One of them is Goals (Basketball).其中之一是目标(篮球)。 I want the component BasketballGoals.vue to appear in this tab.我希望组件BasketballGoals.vue出现在此选项卡中。

这是选项卡

In the component PlayerTabs I define the tabs in the template:在组件 PlayerTabs 中,我定义了模板中的选项卡:

  <v-tab title="Goals (Basketball)">
    <app-basketball-goals></app-basketball-goals>
  </v-tab>

and import the component in the script:并在脚本中导入组件:

import BasketballGoals from "./PlayerBasicInfo/BasketballGoals.vue";

and registered the BasketballGoals component Playertabs in components:并在组件中注册了 BasketballGoals 组件Playertabs

export default {
  components: {
    appPlayers: Players,
    appTimetables: Timetables,
    appHistories: Histories,
    appPhysicalGoals: PhysicalGoals,
    appBasketballGoals: BasketballGoals,
    appScholarship: Scholarship,
  },

The BasketballGoals component starts like this: BasketballGoals 组件如下所示:

<script>
    export default {
        name: 'goals',
        data: function() {
            return {
                times: [{
                    hour: '00',
                    isActive: false
                }, {

Here's the full component .这是完整的组件

I've been trying for hours now to make the component appear in the tab, but I can't make it work and don't get an error too.我已经尝试了几个小时让组件出现在选项卡中,但我无法让它工作并且也没有出现错误。 Can someone help me?有人能帮我吗?

The corresponding component should go in v-tab-item element.相应的组件应该放在v-tab-item元素中。 Here is an example from the tutorial :这是教程中的一个示例:

<v-tabs
  color="cyan"
  dark
  slider-color="yellow"
>
  <v-tab ripple>
    Item 1
  </v-tab>
  <v-tab ripple>
    Item 2
  </v-tab>
  <v-tab-item>
    <v-card flat>
      <v-card-text>Contents for Item 1 go here</v-card-text>
    </v-card>
  </v-tab-item>
  <v-tab-item>
    <v-card flat>
      <v-card-text>Contents for Item 2 go here</v-card-text>
    </v-card>
  </v-tab-item>  
</v-tabs>

So, in your case:所以,在你的情况下:

<v-tab-item>
  <app-basketball-goals></app-basketball-goals>      
</v-tab-item>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM