nuxt.js

How to load a resource on the client side only in Nuxt.js

雨燕双飞 提交于 2019-12-11 18:33:57
问题 I'm trying to build an app using Tone.js on top of Nuxt.js. Tone.js requires the browser's Web Audio API and as Nuxt renders stuff on the server side my build keeps failing. Nuxt addresses this in the plugin documentation and I've followed that approach in my nuxt.config.js file writing: module.exports = { plugins: [{src: '~node_modules/tone/build/Tone.js', ssr: false }], } however that results in this error: [nuxt] Error while initializing app TypeError: Cannot read property 'isUndef' of

Nuxt.js and anchors

岁酱吖の 提交于 2019-12-11 17:18:40
问题 How to deal with anchors (within the same page) in Nuxt.js ? Problem is the URL stays always on the base localhost:3000/ I want to have anchors displayed on the URL too: localhost:3000/#anchor1 , localhost:3000/#anchor2 , localhost:3000/#anchor3 … etc. It seems <nuxt-link :to=(/#anchorid)> Inner link </nuxt-link> does not do the job. How to achieve this functionality? 来源: https://stackoverflow.com/questions/55196920/nuxt-js-and-anchors

Nuxt.js: message: 'This page could not be found' (nuxt-i18n)

谁说我不能喝 提交于 2019-12-11 16:57:30
问题 In my Nuxt.js application, I installed the nuxt-i18n according to how the documentation suggests: { modules: [ ['nuxt-i18n', { // Options }] ] } But when I run npm run dev, I get this error message: DONE Compiled successfully in -4519ms 12:53:52 OPEN http://localhost:3000 nuxt:render Rendering url / +0ms { statusCode: 404, path: '/', message: 'This page could not be found' } How to fix this? 回答1: it works fine if you set a default locale :) modules: [ ['nuxt-i18n', { locales: ['en', 'fr', 'es

Can we combine the SPA concept with dynamic nested routes in Nuxt.js?

北战南征 提交于 2019-12-11 15:58:29
问题 In my Nuxt.js application, I have to use dynamic nested routes. This means I will end up by having various HTML files generated. The problem is that I must embed my whole application within an existing website, on a specific page, to be precise. In the beginning I thought only one page will be needed, but finally I ended up by having multiple pages. How can I embed my files given these constraints? Any approach? Is it possible to combine the SPA concept with dynamic nested routes? 回答1: These

How to deploy Nuxt SSR with mod_rewrite in a sub folder?

风格不统一 提交于 2019-12-11 15:56:48
问题 Currently I'm running a Django based website. I want to replace my "/admin/" area with a Vue/Nuxt build version but keep the rest of my website for now. To serve my files I use Apache2 with mod_rewrite enabled. My Nuxt server is running on localhost:3000. In my .htaccess I wrote this line to proxy /admin/ to the Nuxt Server RewriteRule ^admin/(.*) http://localhost:3000/$1 [P] If I access www.example.com/admin/ I see the output of my Nuxt project. But all resources are not loaded because the

Use Express.js in an existing Nuxt.js project

落爺英雄遲暮 提交于 2019-12-11 15:06:06
问题 I have a project built with Nuxt.js and I want to use express to be able to report bugsnag errors on my asyncData method etc. How would I go to import that? I suppose is not as simple as npm install express --save. I already have an api written in PHP so I would not use that as an api or anything else. Is it overkill? Or is it a necessary evil? :D 回答1: You dont need express to handle errors in asyncData. To handle errors in asyncData/fetch on ssr you just need to hook into render

Errors when publishing my nuxtjs website on SSR mode

最后都变了- 提交于 2019-12-11 14:56:36
问题 I have some issues while trying to publish a nuxtjs site. Usually, I was using the generate command, but for this one I need to go full SSR, so I'm going for nuxt start. But after building and starting the app, it's a mess. The build goes perfectly in the console, and the application start. The problem is when I try to access the site, it loads partially, but I got all these errors in the browser: manifest.3a7efd91c5f63f114507.js Failed to load resource: the server responded with a status of

Cypress tests continuously run XHR posts when visiting localhost (running vue.js)

一个人想着一个人 提交于 2019-12-11 14:26:12
问题 I'm relatively new to cypress, however, whenever I run cy.visit on localhost the XHR requests continuously run. This does not happen if I am visiting a remote URL. Here's the code: describe('Applicant Login', () => { it('focuses input on login box', () => { cy.visit('http://localhost:3000/login') }) }) Cypress continually runs XHR requests over and over until I stop. I'm running a vue.js app via nuxt.js. Here's the log output: I have no errors, no request or response info, the continuous

Nuxt Axios Module read status code

假装没事ソ 提交于 2019-12-11 08:46:00
问题 I'm calling a Rest API that returns at least 2 success status codes . A normal 200 OK and a 202 Accepted status code. Both return a Content in the body. If I execute in postman my calls I might get something like Status code: 202 Accepted. With Body "Queued" or some other values or Status code: 200 OK. With Body "ValueOfSomeToken" Making the call with axios in my nuxt app: this.$axios.$get('/Controller/?id=1') .then((response)=>{ if(response=='Queued'){ //Do something } else if (response==

Nuxt, splitting up Vuex store into separate files gives error: unknown mutation type: login

随声附和 提交于 2019-12-11 08:42:53
问题 I'm trying to split up my Nuxt Vuex store files into separate files . And NOT have all Vuex getters , mutations and actions into one huge file. This demo project is on Github by the way. I'v read this official Nuxt Vuex Store documentation; but can't seem to get it working. It's a bit vague on where to put stuff. I have the following in these files: Below is my: store/index.js import Vue from "vue"; import Vuex from "vuex"; import Auth from "./modules/auth"; Vue.use(Vuex); export const store