お聞きしたいこと
子コンポーネントに対して親コンポーネントからdataを引き渡す際に、下記のような処理を実装しています。
- APIサーバーからデータAを取得し、data.firstに代入
- 上記完了後に、APIサーバーに対して、「URL + data.first」でデータBを取得し、data.secondeに代入
axiosでthenメソッドなども使用していますが、Chromeのコンソールで確認してみると、どうやら代入されていないようです。
<script> import cTable from '../common/Table.vue' import axios from 'axios' export default { name : 'Session', components: { cTable }, data: function() { return { fields: [ { key: 'セッション名' }, { key: 'VLAN ID' }, { key: 'ロケーション' }, { key: 'ユーザー名' }, { key: '接続元ホスト名' }, { key: 'TCPコネクション数' }, { key: '転送バイト数' }, { key: '転送パケット数' }, { key: '切断' }, ], hubs: [], sessions: [], } }, methods: { }, beforeMount() { axios .get("http://localhost/api/hub/session/") .then(response => (this.hubs = response.data)) setTimeout(10) console.log("hub " + this.hubs[0]) axios .get("http://localhost/api/hub/session/" + this.hubs[0]) .then(response => (this.sessions = response.data)) } } </script>
試しにsetTimeoutなども追加しましたが、特に結果は変わらず・・・
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。