0

我无法将数据从根传递new Vue.js到注册组件

仪表板.jade

extends /base

block dashboard
  .dashboard
    //- account vue
    account

仪表板.js

 import Account from '../pages/Account';

 auth.on('user:fetched:success', (e, data) => 
   new Vue({
    el: '.dashboard',

    data: {
      user: data.user // some data
    },

    components: {
      Account
    }
  });
});

账户.vue

<template lang="jade">
  .account
    //- layout goes here
</template>

<script>
  import AccountEmail from '../components/AccountEmail.vue';
  import AccountType from '../components/AccountType.vue';
  import AccountExpire from '../components/AccountExpire.vue';
  import PlatformList from '../components/PlatformList.vue';
  import EmailVerification from '../components/EmailVerification.vue';

  export default {
    name: 'account',

    components: {
      AccountEmail,
      AccountType,
      AccountExpire,
      PlatformList,
      EmailVerification
    },

    created() {
      console.log(this.$data); // there is no data :(
    },

    methods: {
      ...
    }
  };
</script>
4

0 回答 0