nuxt.js

Watch and reload api folder in Vue Nuxt

て烟熏妆下的殇ゞ 提交于 2019-12-10 15:07:53
问题 How to make nuxt watch for "non standard" directories and recompile / reload itself, and more specifically for dirs with additional server apis? I have my express api in ~/api/ . Since I reference the directory in serverMiddleware with '~/api', I would expect Nuxt to reload when I make some changes to the files in that dir, but it doesn't. I'm simply using npm run dev that fires nuxt, I don't have any direct control on either nodemon (if it's used internally) or on webpack (that I'm pretty

Loading D3 with Nuxt/Vue

佐手、 提交于 2019-12-10 14:22:12
问题 I am trying to implement D3 in an app I am building with Nuxt. I have successfully imported it into a view in the <script> section with import * as d3 from 'd3' however because the app is being rendered server-side D3's functionality doesn't work (i.e. d3.select(...) ) due to the lack of browser. In the Nuxt plugin documentation it suggests a pattern for client-only external plugins: module.exports = { plugins: [ { src: '~plugins/vue-notifications', ssr: false } ] } I attempted to implement

Vue: method is not a function within inline-template component tag

廉价感情. 提交于 2019-12-10 10:26:42
问题 I have this component: <template> <div class="modal fade modal-primary" id="imageModal" tabindex="-1" role="dialog" aria-labelledby="ImageLabel" aria-hidden="true"> <div class="modal-dialog modal-lg animated zoomIn animated-3x"> <div class="modal-content"> <ais-index index-name="templates" app-id="BZF8JU37VR" api-key="33936dae4a732cde18cc6d77ba396b27"> <div class="modal-header"> <algolia-menu :attribute="category" :class-names="{ 'nav-item__item': 'nav-color', 'nav-item__link': 'nav-link',

How to start nuxt.js on plesk?

China☆狼群 提交于 2019-12-08 14:01:43
问题 I'm trying to start a nuxt.js project on Plesk. Plesk need a Application Startup File , but nuxt.js have no index file. How can I start the server? Do I have to create a server.js and in this file execute npm run start ? 回答1: I found the solution: In the field Application Startup File you have to put node_modules/nuxt/bin/nuxt-start . 回答2: Need to install nuxt-start module npm i --save nuxt-start in Application Startup File node_modules/nuxt-start/bin/nuxt-start.js 来源: https://stackoverflow

Registering components globally in Vuejs in subfolders

守給你的承諾、 提交于 2019-12-08 07:29:02
问题 I have followed the documentation on the Vuejs website to learn how to register vue components globally. I have defined that the relative path of the components folder is ./global and set to look in subfolder to true (default false). However, it still doesn't look into subfolders. I have also console.logged the components keys to see if any vue components are included, but it only returned the components in the global (root) folder. https://vuejs.org/v2/guide/components-registration.html

Nuxt Multiple assets emit to the same filename hot-update

Deadly 提交于 2019-12-08 07:26:14
问题 So I've been using Nuxt currently without Express and it was working fine. Today I have installed Nuxt again and also picked to install Express with it. Now when I do changes to the files I get this error: Whan can cause this error ? When I restart server with npm run dev it works fine again until I change a file. 回答1: Webpack 4.40.0 was released 12 hours ago. 4.40.1 was released about 15 minutes ago with this error mentioned in the release notes. See github.com/webpack/webpack/releases/tag

Nuxt.js - How to have separate layout?

安稳与你 提交于 2019-12-08 06:07:23
问题 In my default layout I have header and footer for every page. But in error pages I need a full page without header and footer. So I made another layout and I'm calling it in the export default section. But it's still have header and footer. default.vue <template> <div> <app-header></app-header> <nuxt /> <app-footer></app-footer> </div> </template> <script> import Header from '~/components/Header.vue' import Footer from '~/components/Footer.vue' export default { components: { 'app-header':

Nuxt How to set baseURL in dev or production

别等时光非礼了梦想. 提交于 2019-12-08 04:05:36
问题 This seems like a simple Nuxt question, but I just can't figure it out. When running "NPM run dev" I want to set the Axios baseURL to "localhost/api" and when running from the dist folder after "NPM run generate" I want the baseURL to be "/api". Is there a simple solution? 回答1: This is the way to do it: let development = process.env.NODE_ENV !== 'production' module.exports = { axios: { baseURL: development ? 'http://localhost:3001/api' : 'https://domain/api' }, modules: [ '@nuxtjs/axios' ], }

How to add external js file in Nuxt?

僤鯓⒐⒋嵵緔 提交于 2019-12-08 01:10:26
问题 I have js file called script.js in assets/js. Tried to include in nuxt.config.js like below: head: { title: pkg.name, meta: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: pkg.description } ], link: [ { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } ], script: [ { src: '/assets/js/script.js', ssr: false } ] } But getting 'GET http://127.0.0.1:3000/assets/js/script.js 404 (OK)'. 回答1:

Vuetify CSS comes after my own CSS with Nuxt 2.0

ぐ巨炮叔叔 提交于 2019-12-08 00:57:45
问题 In my test project https://github.com/alechance/nuxt-vuetify-lodash I'm trying to write my own CSS. However Vuetify CSS always comes after my CSS in my <head> , any idea how I can order my styles so my CSS comes after? I do not want to end up writing important! 来源: https://stackoverflow.com/questions/53087096/vuetify-css-comes-after-my-own-css-with-nuxt-2-0