测试环境:vue v2.3.3, vue v2.3.1 案例一父组件parent.vue// asyncData为异步获取的数据,想传递给子组件使用 <template><div>父组件<child :child-data="asyncData"></child></div> </template><script>import child from ./childexport default {data: () => ({asyncData: }),components: {child},created () {},mounted () {// setTimeout模拟异步数据setTimeout(() => {this.asyncData = async dataconsole.log(parent finis...
我有2个商店:UserStore和TodoStore.为了获取待办事项,我需要知道已登录用户的ID. 那是我的UserStore的一部分export default class UserStore {@observable currentUser = null;@observable loading = false;constructor() {this.subscribe();}@action subscribe = () => {this.loading = true;firebase.auth().onAuthStateChanged((user) => {if(user) {this.setCurrentUser(user);} else {this.unsetCurrentUser();}this.loading...