It seems like the issue is with the Vue Router intercepting the request for the XLSX file. One solution could be to add an exception to the Vue Router to allow requests to the /tmp/ directory. This can be done by adding a new route to the Vue Router that matches any URL starting with /tmp/ and setting the beforeEach hook to skip this route. Here's an example:
const router = new VueRouter({
routes: [
// Add this route to allow requests to /tmp/ directory
{ path: '/tmp/*', meta: { skipAuth: true } },
// Other routes here
],
mode: 'history'
});
router.beforeEach((to, from, next) => {
// Skip authentication for routes with meta.skipAuth set to true
if (to.matched.some(record => record.meta.skipAuth)) {
next();
} else if (!to.matched.length) {
console.log('to.path::')
console.log(to.path)
alert( "/not-found/" )
} else {
next();
}
});
This will allow requests to the /tmp/ directory to bypass the Vue Router and be handled by the server. You can then use the window.open method to open the XLSX file as before:
fileurl = 'http://localhost/tmp/test-item.xlsx';
window.open(fileurl,'_blank');