私はvueアプリケーションとルーターをプッシュし、別のルーターコンポーネントにデータを渡す機能を持っています。Vue:イベントバスを使用してコンポーネントに渡されたコンポーネントのデータが渡されました
passData: function() {
EventBus.$emit('passName', this.tableRow[0]);
this.$router.push('/analytic-two');
}
次に、他のコンポーネント。
<template>
<p>
This is Data passed from chart component {{passedRow}}
</p>
</template>
<script>
import { EventBus } from '../event-bus.js';
export default {
data() {
return {
passedRow: [
{
"name": "",
"numSongs": "",
"Year": ""
}
],
name: '',
id: '?',
};
},
created: function() {
const self = this;
EventBus.$on('passName', function (value) {
self.passedRow = value;
console.log(self.passedRow);
});
},
}
</script>
私は、データが通過来て、そのがログに記録されている知っているが、私は、誰もが任意のアイデアを持っていない私のテンプレートでそれを表示する方法を見つけ出すことはできません。
これは使用しているコードですか?それはこのペンで働いています:https://codepen.io/luord/pen/awYOyz –