nuxt.js

nuxt generate payload undefined

我的梦境 提交于 2021-02-10 21:16:11
问题 I have a Nuxt project, in nuxt.config.js file, I have a function like this: generate: { async routes() { function postRoutes() { return axios .post('https://my-server.com/api/posts') .then((r) => r.data.map((post) => { // I log post data here, it exist console.log(post) return { route: `post/${post.id}`, payload: 'post' } })) } const response = await axios .all([postRoutes()]) .then(function (results) { const merged = [].concat(...results) return merged }) return response } }, Then, in pages

nuxt generate payload undefined

五迷三道 提交于 2021-02-10 21:12:52
问题 I have a Nuxt project, in nuxt.config.js file, I have a function like this: generate: { async routes() { function postRoutes() { return axios .post('https://my-server.com/api/posts') .then((r) => r.data.map((post) => { // I log post data here, it exist console.log(post) return { route: `post/${post.id}`, payload: 'post' } })) } const response = await axios .all([postRoutes()]) .then(function (results) { const merged = [].concat(...results) return merged }) return response } }, Then, in pages

Convert Vue.JS project to Nuxt.JS project

泪湿孤枕 提交于 2021-02-10 20:26:59
问题 I want to create Nuxt.JS project from Vue.JS project. Vue.js Project You can see the full Vue.JS project here. This project uses npm package vue-conversational-form which can help turn web forms into conversations using Vue.js. Project has 3 files: index.html index.js myForm.js Code of: index.html <style> html, body { height: 90%; width: 96%; background: #eee; margin: 10px auto; } </style> <div id="app"></div> Code of: index.js import Vue from 'vue' import myForm from './myForm'; new Vue({ el

Nuxt + IOT (aws-iot-device-sdk)

柔情痞子 提交于 2021-02-10 19:57:25
问题 I create a plugin like this: var awsIot = require('aws-iot-device-sdk') var device = awsIot.device({ keyPath: 'xxxxxx, certPath: 'xxxxxx, caPath: 'xxxxxx', clientId: 'xxxxx', region: 'xxxxxx', host: 'xxxxxxxxxx.amazonaws.com' }) It works, but displays an error message: C:\Sistemas\AM\nodemodules\aws-iot-device-sdk\common\lib\tls-reader.js:89 Uncaught TypeError: filesys.existsSync is not a function at webpackJsonp../nodemodules/aws-iot-device-sdk/common/lib/tls-reader.js.module.exports How can

Access to this.$apollo from Vuex store with vue-apollo in NUXT?

喜夏-厌秋 提交于 2021-02-10 13:59:45
问题 I want to store the user that comes from the login on an action in the vuex store. But there is no access to this.$apollo . export const actions = { UPSERT_USER({ commit }, { authUser, claims }) { this.$apollo .mutate({ mutation: UPSERT_USER_MUTATION, variables: { id: user.uid, email: user.email, name: user.name, picture: user.picture, }, }) } Thanks! 回答1: You should be able to access it like this: export default { actions: { foo (store, payload) { let client = this.app.apolloProvider

Nuxt compiles CSS Opacity at 1% instead of 100% when deployed to Netlify

ぐ巨炮叔叔 提交于 2021-02-09 08:29:59
问题 I have a Nuxt app that works great locally. When I deployed it to Netlify (where yarn generate was run automatically), I noticed that there were some odd CSS things going on. I have a card with a hover effect: <style lang="scss" scoped> .gallery-card { align-items: center; background: url('/backgrounds/image-1.jpg') no-repeat center center; background-size: cover; cursor: pointer; display: flex; flex-direction: column; height: 400px; justify-content: center; position: relative; max-width: 100

Nuxt compiles CSS Opacity at 1% instead of 100% when deployed to Netlify

雨燕双飞 提交于 2021-02-09 08:29:51
问题 I have a Nuxt app that works great locally. When I deployed it to Netlify (where yarn generate was run automatically), I noticed that there were some odd CSS things going on. I have a card with a hover effect: <style lang="scss" scoped> .gallery-card { align-items: center; background: url('/backgrounds/image-1.jpg') no-repeat center center; background-size: cover; cursor: pointer; display: flex; flex-direction: column; height: 400px; justify-content: center; position: relative; max-width: 100

Nuxt compiles CSS Opacity at 1% instead of 100% when deployed to Netlify

浪子不回头ぞ 提交于 2021-02-09 08:28:00
问题 I have a Nuxt app that works great locally. When I deployed it to Netlify (where yarn generate was run automatically), I noticed that there were some odd CSS things going on. I have a card with a hover effect: <style lang="scss" scoped> .gallery-card { align-items: center; background: url('/backgrounds/image-1.jpg') no-repeat center center; background-size: cover; cursor: pointer; display: flex; flex-direction: column; height: 400px; justify-content: center; position: relative; max-width: 100

Nuxt compiles CSS Opacity at 1% instead of 100% when deployed to Netlify

我只是一个虾纸丫 提交于 2021-02-09 08:27:34
问题 I have a Nuxt app that works great locally. When I deployed it to Netlify (where yarn generate was run automatically), I noticed that there were some odd CSS things going on. I have a card with a hover effect: <style lang="scss" scoped> .gallery-card { align-items: center; background: url('/backgrounds/image-1.jpg') no-repeat center center; background-size: cover; cursor: pointer; display: flex; flex-direction: column; height: 400px; justify-content: center; position: relative; max-width: 100

GitHub Actions workflow error: Run Command Timeout! Even if the script did well

◇◆丶佛笑我妖孽 提交于 2021-02-09 01:44:16
问题 I want to deploy my Nuxt.js application on my remote server each time I commit into repository. Here is my deploy.yml: name: 'Deployment' on: push: branches: ['master'] jobs: deploy: name: Deploy runs-on: ubuntu-latest steps: - name: Connect to SSH uses: appleboy/ssh-action@master with: host: webhostgb.com username: root key: ${{ secrets.PRIVATE_KEY }} port: 22 script: | cd whgb-new git pull origin master npm run build fuser -kn tcp 3000 pm2 restart deploy.sh Basically deploy.sh runs npm