nuxt.js

Is there a created() for vuex actions to auto dispatch

不羁岁月 提交于 2019-12-11 07:57:34
问题 I have an action within vuex that I would like to auto dispatch within vuex itself rather than a component. I have created a notification bar that changes through different notifications which is on multiple pages. Rather than the notifications start from the beginning when I switch page I have created a store to set which notification to show. I would like to dispatch the rotate function in the vuex store from within vuex rather than from within a component Please note: I'm using Nuxt VUEX

nuxt.js -> Howto configure production/development settings

会有一股神秘感。 提交于 2019-12-11 06:36:07
问题 I have a nuxt.js project with feathers. The client and server are to different entities, you start them seperatly. The client uses nuxt.js. I want to configure production and development settings. Currently my nuxt.config.js looks like this: module.exports = { head: { title: "SITE TITLE" }, env: { backendUrl: 'http://localhost:3001' } }; What I would like is that if I start the client with 'npm run dev' development setting are used. I would like to have e.g. a different header and different

How to use webpack dev proxy with Nuxt

烂漫一生 提交于 2019-12-11 06:19:29
问题 Using Nuxt to develop a universal JS app, I'm attempting to configure webpack's dev proxy so that, in development only , requests to /api get proxied to http://127.0.0.1:500/api where they'll reach a Python REST API. Following the Nuxt docs, I've extended the webpack config in nuxt.config.js like so: build: { extend (config, { isDev }) { // Proxy /api to Python only in dev if (isDev) { const devServer = { proxy: { '/api': 'http://127.0.0.1:5000' } } config.devServer = devServer; } } } If I

vuetifyjs-nuxt: can not add any UI component [duplicate]

左心房为你撑大大i 提交于 2019-12-11 05:48:09
问题 This question already has an answer here : <v-card> - did you register the component correctly? (1 answer) Closed last year . I am using vuetifyjs/nuxt starter template. It launches correctly, however when I try to add a <Bagde /> UI componenent to the default.vue inside the <v-toolbar /> component, I am getting this error: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option. In fact, this happens whenever I want

Using different text values with vuetify component

喜欢而已 提交于 2019-12-11 05:26:12
问题 I'm interested in using a vuetify expansion panel component in a nuxt project. I'm looking at https://vuetifyjs.com/en/components/expansion-panels#examples . The exampleas all show the same text and header for each subpanel based on code that looks like: <v-app id="inspire"> <div> <div class="text-xs-center mb-3">{{ panel }}</div> <v-expansion-panel v-model="panel" expand > <v-expansion-panel-content v-for="(item, i) in 5" :key="i" > <div slot="header">Item</div> <v-card> <v-card-text class=

How to use ag-grid in a Nuxt app

主宰稳场 提交于 2019-12-11 05:24:47
问题 I'm building a Nuxt application and I'm trying to render an ag-grid in one of my pages I created a plugin called ag-grid.js : import * as agGridEnterpise from 'ag-grid-enterprise/main' agGridEnterpise.LicenseManager.setLicenseKey([MY_LICENSE_KEY]) On nuxt.config.js i have registered the plugin: plugins: [ //... { src: '~/plugins/ag-grid.js', ssr: false } ], And in my page component i have: <template> <ag-grid-vue ref="table" class="ag-theme-material" :pinnedTopRowData="pinnedRow ? [pinnedRow]

how to import internal global JS in nuxt.config.js

江枫思渺然 提交于 2019-12-11 05:15:08
问题 How do I add a global JS file to the nuxt config? module.exports = { /* ** Global CSS */ css: ['~/assets/css/main.css'], /* ** Global JS */ js: ['~/assets/js/main.js'] } It does not work obviously. any ideas? 回答1: Simply keep your script.js file into static folder, because static folder treat as root folder. and change nuxt.config.js configuration file like below module.exports = { //Global JS script: [ { src: '/script.js'} ] ........ .......... } you can see another solution from here 来源:

NUXT: Could not compile template

可紊 提交于 2019-12-11 02:27:45
问题 I'm getting started with nuxt. My project structure in the screenshot, I've got a vuetify carousel component that was working fine with urls as the src. Now I want to try to serve local static files. I tried: <template> <v-carousel> <v-carousel-item v-for="(item,i) in items" :key="i" :src="item.src"></v-carousel-item> </v-carousel> </template> <script> export default { data () { return { items: [ { src: '/static/52lv.PNG' }, { src: 'https://cdn.vuetifyjs.com/images/carousel/sky.jpg' }, { src:

Plugin only server side

◇◆丶佛笑我妖孽 提交于 2019-12-10 21:55:13
问题 I have a plugin that I don't want the client to see. Unfortunately it is allways built both for the server and the client. How can this be prevented? <template> <div> Test </div> </template> <script> import getAll from '~/plugins/api' export default { asyncData (context, callback) { getAll(function(data){ callback(null,data); }) } } </script> This is my .vue file. The fetch of the data is working but i can also See the code from the client side which i don't want. 回答1: Maybe you can use the

How to pass props to <nuxt /> component pages

别来无恙 提交于 2019-12-10 18:54:51
问题 Has anyone been able to pass props to pages in Nuxt.js? Typical Vue.js props can be passed as so: // parent-component.vue <child-component :basket-count="items.length"/> <script> import ChildComponent from './child-component' export default { data () { items: [{}, {}] }, components: { childComponent: ChildComponent } } </script> // child-component.vue <p>You have {{ basketCount }} items in your basket</p> <script> export default { props: [ 'basket-count' ] } </script> But when using the <nuxt