Vue.js

Redirect authenticated users nuxt js

孤者浪人 提交于 2021-01-29 18:25:40
问题 I have the following code from my state to handle the login request and load the incoming data to state. export const state = { userId: "", token: "", authenticated: false }; export const getters = {}; export const actions = { async login({ commit, dispatch }, formData) { //codes to get data from server goes here // incoming datas are {status: true,token: 'token123', userId: '123'} const remainingMilliseconds = 60 * 60 * 1000; const expiryDate = new Date(new Date().getTime() +

Vue.js - draw multiple image on canvas from screenshots of video

房东的猫 提交于 2021-01-29 17:51:11
问题 I am having trouble with a feature I want to implement in Vue.js. What I want to achieve is accessing the webcam and displaying it in a html5 video element. This does work. Then, I implemented a button that @click runs a method that takes a screenshot. The goal is to take as many screenshots as desired and to display them somewhere on the page. What I achieved so far is that generally a screenshot can be taken. However, whenever a new screenshot is taken (the button is clicked again) the old

Typescript: class extending Array, can't assign method

爱⌒轻易说出口 提交于 2021-01-29 17:42:57
问题 I'm working with Typescript and Vue, but I hope that my framework doesn't matter. I'm trying to extend Array like that: class AudioArray extends Array<[number, number]> { constructor(size: number) { super(size); } static fromArray(array: Array<number>): AudioArray { return array.map((v, i) => [i, v]) as AudioArray; } addNumber(num: number): AudioArray { return this.map((x: [number, number]) => [x[0], x[1] + num]) as AudioArray; } } export default AudioArray; and I'm importing it into my

I'm upgrading the Vuetify version from 1.5 to 2.0, but the previously installed plugin is no longer visible in the project

China☆狼群 提交于 2021-01-29 17:15:41
问题 old vuetify plugins not showing, but new vuetify plugins appear.v-checkbox as an example. can you help me v-checkbox is not visible **Vuetify JS After 2.0 update** // v2.0 // src/plugins/vuetify.js // follow official document import Vue from 'vue'; import Vuetify from 'vuetify/lib'; Vue.use(Vuetify); export default new Vuetify({ dark: true, // it's decide your project themes: { light: { prime: '#df8421' }, dark: { prime: '#333' } }, icons: { iconfont: 'mdi', }, }); After 2.0 update main js Is

relative path in @nuxtjs/dotenv

馋奶兔 提交于 2021-01-29 16:32:06
问题 I am building an SSR nuxt.js project with laravel backend, and I want to share the .env for both laravel and nuxt. Here is my folder structure (base on a laravel folder structure but add a client folder to put nuxt) here is my nuxt.config.js module.exports = { srcDir: __dirname, buildModules: [ [ '@nuxtjs/dotenv', { path: '../' } ] ] } package.json { "private": true, "scripts": { "dev": "node_modules/nuxt/bin/nuxt.js -c client/nuxt.config.js", "build": "node_modules/nuxt/bin/nuxt.js build -c

Vuetify: Why is the sidebar laying over the other element?

被刻印的时光 ゝ 提交于 2021-01-29 16:22:07
问题 My sidebar is laying over the router-view but it should be "blocking" the space. In my App.vue there is following code <template> <v-app id="app"> <v-container> <sidebar class="d-block"/> <router-view class="d-block"></router-view> </v-container> </v-app> </template> Due to the d-block class of Vuetify I'd expect the sidebar to not overlay. The sidebar is basically copied from the original API <template> <v-container> <v-navigation-drawer v-model="drawer" :color="color" :permanent="permanent"

ISO proper way to chain Webpack via vue.config.js to add global .scss imports to my .vue files (vue-cli-plugin-nativescript-vue)

扶醉桌前 提交于 2021-01-29 16:15:28
问题 I have Vue.js project I've setup previously that dynamically adds defined .scss files to my .vue template files, so I can access my variables, mixins, etc. in the templates without @importing them, or having them duplicate code from imports. My problem is I'm setting up a NativeScript/Vue.js project with vue-cli-plugin-nativescript-vue and was curious if anyone has successfully setup their webpack to allow the same functionality. It's my understanding that the plugin replaces webpack with the

Chartjs gradient background color based on min and max values

ぃ、小莉子 提交于 2021-01-29 15:42:04
问题 I'm using chartjs with vue-chart to display some data in my application and actually what I would like to achieve is to have a Bar chart with a background color from red to green. The chart has dynamic min and max values but it cannot be less than 0 and greater than 5. Similar to a 5 star rating. In order to show differences in the displayed data I'm not fixing the chart min/max from 0 to 5. Currently this is the code to show my chart: Options: min is -0.2 than minimum value but not less than

How to display/highlight the respective option with respect to the $route.params.id in vs-select in the context of VueJS

只愿长相守 提交于 2021-01-29 15:33:57
问题 I am displaying multiple options coming from the API in vs-select. ComponentA.vue .... <div class="content-right"> <vs-button class="btn" @click="$router.push({name: 'ProjectWorld', params: {uid: out.uid.toString() }}).catch(err => {})">Open Lab</vs-button> </div> .... created (){ this.$http.get('/my-project') .then((res) => {this.out= res.data}) .catch((e) => {console.log(e)}) } I am using cards in the first page and each card has Open Lab button, so which ever button the user clicks it goes

Dealing with many attributes mapping to a parent component list in VueJS

强颜欢笑 提交于 2021-01-29 15:22:24
问题 I've got a list of components where I'd like them all to be editable / replicate state to the parent component. The list component exists as: Vue.component("shortcuts", { props: { shortcuts: Array }, template: '...<shortcut-entry v-for="(shortcut, index) in shortcuts" v-bind:key="index" v-bind="shortcut" @remove="remove(index)"></shortcut-entry>...' }) It's used with a model like this: <shortcuts v-bind:shortcuts.sync="shortcuts"></shortcuts> Now each shortcut-entry component will contain