nuxt.js

How to use Facebook SDK with Nuxt.js?

青春壹個敷衍的年華 提交于 2019-12-01 01:59:15
问题 You can see my code. npm install vue init nuxt/koa my-project (koa@2) pages |- login.vue <script> export default { name: 'login', method: { login () { let vm = this FB.login(function (response) { vm.statusChangeCallback(response) }, {scope: 'publish_actions'}) } }, mounted () { console.log('mounted') let vm = this window.fbAsyncInit = () => { FB.init({ appId: 'my-facebook-app-id', cookie: true, xfbml: true, version: 'v2.8' }) FB.getLoginStatus(function (response) { vm.statusChangeCallback

POST file along with form data Vue + axios

佐手、 提交于 2019-11-30 22:27:47
I have a method for Vuejs component: async submit () { if (this.$refs.form.validate()) { let formData = new FormData() formData.append('userImage', this.avatarFile, this.avatarFile.name) this.avatarFile = formData try { let response = await this.$axios.post('http://localhost:3003/api/test.php', { avatar: this.avatarFile, name: this.name, gender: this.gender, dob: this.DOB, }, { headers: { 'Content-Type': 'multipart/form-data; boundary=' + formData._boundary } }) if (response.status === 200 && response.data.status === 'success') { console.log(this.response) } } catch (e) { console.log(e) } } }

Dynamically get image paths in folder with Nuxt

别说谁变了你拦得住时间么 提交于 2019-11-30 20:20:23
I'm using nuxt with vuetify. I have a working carousel component .I want to generate a list of The .png files in the static folder. Following Dynamically import images from a directory using webpack and Following https://webpack.js.org/guides/dependency-management/#context-module-api my component looks like: <template> <v-carousel> <v-carousel-item v-for="(item,i) in items" :key="i" :src="item.src"></v-carousel-item> </v-carousel> </template> <script> var cache = {}; function importAll(r) { r.keys().forEach(key => cache[key] = r(key)); } var getImagePaths = importAll(require.context('../static

前端技术之:使用npx创建一个Nuxt.js项目

此生再无相见时 提交于 2019-11-30 20:03:21
$ npx create-nuxt-app my-first-nuxtjs npx: 401 安装成功,用时 43.891 秒 > Generating Nuxt.js project in /Users/popgis/projects/my-first-nuxtjs ? Project name my-first-nuxtjs ? Project description A Nuxt.js application for test. ? Use a custom server framework express ? Use a custom UI framework element-ui ? Choose rendering mode Universal ? Use axios module yes ? Use eslint yes ? Use prettier yes ? Author name popgis ? Choose a package manager npm Initialized empty Git repository in /Users/popgis/projects/my-first-nuxtjs/.git/ > fsevents@1.2.4 install /Users/popgis/projects/my-first-nuxtjs/node

Vuejs Error: The client-side rendered virtual DOM tree is not matching server-rendered

随声附和 提交于 2019-11-30 09:12:24
I am using Nuxt.js / Vuejs for mmy app, and I keep facing this error in different places: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render. I would like to understand what is the best way to debug this error? Is their a way I can record/get the virtual DOM tree for client and server so I could compare and find where the error lies? Mine is a large application and manually verifying is

I want to use window.localStorage in Vuex in Nuxt.js

瘦欲@ 提交于 2019-11-30 07:45:16
I developing nuxt.js app. And point is login & logout. We will develop a login to the JWT system. You must remain logged in at vuex. However, when I refresh the page, vuex is initialized. I've read git vuex-persistedstate , but it's hard to understand just how to initialize and set it. What is the best way to develop a login system in nuxt.js? Thanks. Using vuex-persisted state would be the best use case for your scenario. I will walk you through the process of using vuex-persisted state. Open command line, cd to your project directory, then enter npm install --save vuex-persistedstate . This

Dynamically get image paths in folder with Nuxt

半世苍凉 提交于 2019-11-30 03:51:29
问题 I'm using nuxt with vuetify. I have a working carousel component .I want to generate a list of The .png files in the static folder. Following Dynamically import images from a directory using webpack and Following https://webpack.js.org/guides/dependency-management/#context-module-api my component looks like: <template> <v-carousel> <v-carousel-item v-for="(item,i) in items" :key="i" :src="item.src"></v-carousel-item> </v-carousel> </template> <script> var cache = {}; function importAll(r) { r

Fully dynamic vue-router

。_饼干妹妹 提交于 2019-11-29 15:41:16
We are building an enormous website based on Vue and Nuxt with over 25 different page types that cannot be matched with standard /:id or /overview/:slug logic that comes out of the box with Vue Router. As slug-matching isn't an option, we are thinking about the following solution: User visits page "/this-is-a-topic-page" Server calls API that returns the pageType topicPage topicPage relates to the nuxt page WpTopicPage We set WpTopicPage as our component within our wildcard instance of Vue Router This looks like the following in code: export function createRouter() { return new Router({ mode:

Fully dynamic vue-router

痞子三分冷 提交于 2019-11-28 09:27:42
问题 We are building an enormous website based on Vue and Nuxt with over 25 different page types that cannot be matched with standard /:id or /overview/:slug logic that comes out of the box with Vue Router. As slug-matching isn't an option, we are thinking about the following solution: User visits page "/this-is-a-topic-page" Server calls API that returns the pageType topicPage topicPage relates to the nuxt page WpTopicPage We set WpTopicPage as our component within our wildcard instance of Vue

How to add a polyfill to nuxt 2.0?

旧城冷巷雨未停 提交于 2019-11-28 07:34:34
In Nuxt 1.4.2 , I had the following in my nuxt.config.js : build: { vendor: ['babel-polyfill'], babel: { presets: [ ['vue-app', { useBuiltIns: true, targets: { ie: 11, uglify: true }, }, ], ], }, }, It seems that all of this is broken in Nuxt 2.0 . At a minimum I'm looking to polyfill enough to get IE 11 working. Here's what I've tried: Using vendor as I used to Removing build.babel allowed the build process to work: build: { vendor: ['babel-polyfill'], }, But I think build.vendor is just ignored now, so this seems to do nothing. Using polyfill.io I tried adding: script: [ { src: 'https://cdn