@fostsinger

Почему не переходит на другой компонент?

<div class="box_profile">
      <div class="box_left">
        <a href="#">Settings</a>
        <a href="#" @click="switchActive('users')">Users</a>
        <a href="#"   @click="switchActive('history')" class="active">History</a> </div>
      <div class="box_right">
<components :is="users"> </components>

<script>
import users from "~/components/users.vue"
  import history from "~/components/history.vue"
 components: {
        users,
        history
      },
      data() {
        return {
          active: 'users',

        }
      },
methods: {
        switchActive: function(view) {
          this.active = view;
          console.log("ok")
        }
      },
    }
</script>
выводит ошибку
Property or method "users" is not defined on the instance but referenced during render.
  • Вопрос задан
  • 126 просмотров
Пригласить эксперта
Ответы на вопрос 1
delphinpro
@delphinpro
frontend developer
вероятно опечатка здесь

<components :is="users"> </components>
<components :is="active"> </components>


Пример jsfiddle.net/4813uLdj

.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы