nuxt.js

NuxtServerInit not working on Vuex module mode - Nuxt.js

那年仲夏 提交于 2020-08-27 06:48:06
问题 NuxtServerInit is not working on initial page render on nuxt js vuex module mode. But it works on Classic mode. Following code is the flow I used. My api call api/CategoryApi.js import axios from 'axios'; const HEADERS = { Accept: 'application/json' }; export default { getCategory(payload) { return axios.get(`${process.env.apiUrl}/category`, { payload, headers: HEADERS }); } } store/modules/CategoryStore.js import api from '~/api/CategoryApi' const state = () => ({ categories: [] }); const

loading a css file from 'assets' directory in a NUXT layout

余生颓废 提交于 2020-08-26 13:41:19
问题 in a nuxt layout (default.vue) I want to load an image and a css file from assets folder the image loaded successfully, but the css file not, why? /layouts/default.vue <template> <img src="~assets/photo.jpg" /> <!-- converted to /_nuxt/assets/photo.jpg and loaded successfully --> </template> <script> export default{ head:{ link: [ { rel: 'stylesheet', href: '~assets/style.css' }] } } </sript> when I view the source code: <link href="~assets/style.css" /> and it fails to be loaded also

loading a css file from 'assets' directory in a NUXT layout

大憨熊 提交于 2020-08-26 13:41:18
问题 in a nuxt layout (default.vue) I want to load an image and a css file from assets folder the image loaded successfully, but the css file not, why? /layouts/default.vue <template> <img src="~assets/photo.jpg" /> <!-- converted to /_nuxt/assets/photo.jpg and loaded successfully --> </template> <script> export default{ head:{ link: [ { rel: 'stylesheet', href: '~assets/style.css' }] } } </sript> when I view the source code: <link href="~assets/style.css" /> and it fails to be loaded also