如何将外部vue.js库导入laravel / vue.js应用程序?

时间:2019-06-11 13:07:37

标签: laravel vuejs2

您好,我正在开发Laravel / vue.js应用程序。 我需要使用vue.js导出csv。 但是问题是,我不知道如何正确导入外部库。

app.js

require('./bootstrap');

window.Vue = require('vue');
require('vue-chartjs');
require('vue-json-csv');

/**
 * The following block of code may be used to automatically register your
 * Vue components. It will recursively scan this directory for the Vue
 * components and automatically register them with their "basename".
 *
 * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
 */

// const files = require.context('./', true, /\.vue$/i);
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default));
Vue.component('order-component', require('./components/OrderComponent.vue').default);
Vue.component('product-component', require('./components/ProductComponent.vue').default);
Vue.component('customer-component', require('./components/CustomerComponent.vue').default);
Vue.component('ca-component', require('./components/CustomerComponent.vue').default);
Vue.component('csv-component', require('./components/CsvComponent.vue').default);
Vue.component('test-customer-component', require('./components/TestCustomerComponent.vue').default);

在我的组件Order中:

<script>
    import JsonCSV from 'vue-json-csv'
    Vue.component('downloadCsv', JsonCSV)
...

0 个答案:

没有答案