Authored by 郭成尧

dispatch-bus

const Vue = require('vue');
const Logistics = require('home/refund/logistics.vue');
const LogisticsCompany = require('home/refund/logistics-company.vue');
const bus = require('plugin/vue-bus');
new Vue({
el: '#logistics',
... ... @@ -13,11 +14,11 @@ new Vue({
logistics: Logistics,
logisticsCompany: LogisticsCompany
},
events: {
changeView: function(obj) {
created() {
bus.$on('changeView', function(obj) {
this.currentView = obj.view;
this.company_id = obj.company_id;
this.company_name = obj.company_name;
}
});
}
});
... ...
... ... @@ -15,6 +15,7 @@
<script>
const indexList = require('components/tools/index-list.vue');
const bus = require('plugin/vue-bus');
module.exports = {
props: ['company_list'],
... ... @@ -54,7 +55,7 @@
this.showData = filter;
},
select(companyId, companyName) {
this.$dispatch('changeView', {
bus.$emit('changeView', {
view: 'logistics',
company_id: companyId,
company_name: companyName
... ...
... ... @@ -18,6 +18,7 @@
const $ = require('yoho-jquery');
const tip = require('plugin/tip');
const modal = require('plugin/modal2');
const bus = require('plugin/vue-bus');
module.exports = {
props: ['applyid', 'type', 'company_id', 'company_name'],
... ... @@ -28,7 +29,7 @@
},
methods: {
companylist() {
this.$dispatch('changeView', { // TAR-TODO 弃用的方法
bus.$emit('changeView', {
view: 'logisticsCompany'
});
},
... ...