I decided to streamline my code by moving some functions into a JavaScript file like this:
[...]
function changeToEditView(reportId)
{
let pathEdit="/edit/"+reportId;
this.$router.push({ path: pathEdit, replace: true });
}
[...]
export {convertDate, deleteReport, changeToEditView, getPdfByReportId}
However, when I import these functions into my Vue component like this
import axios from 'axios'
import convertDate from '@/js/methods'
import deleteReport from '@/js/methods'
import changeToEditView from '@/js/methods'
import getPdfByReportId from '@/js/methods'
export default
{
[...]
methods:
{
convertDate,
deleteReport,
changeToEditView,
getPdfByReportId,
I encounter the following warning messages:
warning in ./src/views/DashboardView.vue?vue&type=script&lang=js
export 'default' (imported as 'deleteReport') was not found in '@/js/methods' (possible exports: changeToEditView, convertDate, deleteReport, getPdfByReportId)
warning in ./src/views/DashboardView.vue?vue&type=script&lang=js
export 'default' (imported as 'changeToEditView') was not found in '@/js/methods' (possible exports: changeToEditView, convertDate, deleteReport, getPdfByReportId)
warning in ./src/views/DashboardView.vue?vue&type=script&lang=js
export 'default' (imported as 'getPdfByReportId') was not found in '@/js/methods' (possible exports: changeToEditView, convertDate, deleteReport, getPdfByReportId)
I attempted adding 'default' after export in the JavaScript file like this but none of the functions seem to work
export default {convertDate, deleteReport, changeToEditView, getPdfByReportId}