Vue.js

Vue DOM image won't show correctly

丶灬走出姿态 提交于 2021-02-05 08:54:28
问题 I'm using the Vue framework and creating an image using the DomUtil.Create function. In this image I want to dynamically write the source to this image. But the image won't show to the user. I put a normal image on the page using the <img> tag and it works here. Only when creating the DOM element it doesn't work. I put the path hard coded in here so it is certain that the path is correct. var img = L.DomUtil.create("img", "popUpImg", divImg); img.src = '@/assets/pictures/1.png'; 回答1: Use

Theory: Axios Calls (Specifically for VueJS)

孤街浪徒 提交于 2021-02-05 08:34:04
问题 On component mount() , Axios fetches information from the back end. On a production site, where the user is going back and forth between routes it would be inefficient to make the same call again and again when the data is already in state . How do the pros design their VueJS apps so that unnecessary Axios calls are not made? Thank you, 回答1: If the data is central to your application and being stored in Vuex (assuming that's what you mean by "state" ), why not just load it where you

Theory: Axios Calls (Specifically for VueJS)

泪湿孤枕 提交于 2021-02-05 08:33:34
问题 On component mount() , Axios fetches information from the back end. On a production site, where the user is going back and forth between routes it would be inefficient to make the same call again and again when the data is already in state . How do the pros design their VueJS apps so that unnecessary Axios calls are not made? Thank you, 回答1: If the data is central to your application and being stored in Vuex (assuming that's what you mean by "state" ), why not just load it where you

Trigger Method in Sibling Component Vue JS

血红的双手。 提交于 2021-02-05 08:23:06
问题 need your assistance once again. Here's my situation. VueJS2 (vue-cli project) no Vuex. I have parent component, child1 and child2 . child1 is a form that gets data from child2 (which is a table). Upon clicking on table row's checkbox in child2 , we fill up the form in child1 this is done by event emitting via parent (picture 2). child1 has a button and reset method (see picture 1) to clear its fields. My task is: when I 'uncheck' checkbox in table row child2 , form in child1 has to be

Problem on manual page refresh due to params passed in the URL

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-05 08:19:10
问题 How do you all recommend page reloads (i.e. if a User presses refresh page) when using variables within the URL? I've generated a site statically with nuxt generate and am hosting it at http://www.wowrares.com/ . The site generates links properly and is able to navigate to the zone when clicking on the sidebar nav link, but if I were to manually enter http://www.wowrares.com/zone/Ashenvale , it says Page Not Found Looks like you've followed a broken link or entered a URL that doesn't exist on

rejected HTTP promise doesn't hit catch block

☆樱花仙子☆ 提交于 2021-02-05 07:48:46
问题 I use VueJs (and Vuex) with Axios to communicate with an Express Api. I can delete my own user account consuming a service import api from '@/services/api.js'; export default { deleteAccount: () => api().delete('/users') }; where api is the axios instance. I don't need to pass in a user ID because the api identifies the user by the token . Within my settings view I can consume this service <script> import { mapActions } from 'vuex'; import UserService from '@/services/users'; export default {

odd problems in Convert Vuejs Typescript Options to Composition Api

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-05 07:45:08
问题 the problem has been solved, read through the question to see how step by step fix the problems I read about composition api(https://vue-composition-api-rfc.netlify.com/#api-introduction), and tried to convert my existing code which is based on typescript on Option api in vuejs, and i failed to make it work, and kinda confused about how composition api really work. my working code is below: <script lang="ts"> import Vue from "vue"; import {inputFields} from "@/mixins/inputField/inputField";

How to check if data is returned from api?

半腔热情 提交于 2021-02-05 07:12:38
问题 How to check if my api request returns me any data from fetchData function?, I want to return boolean (or something else) to my Index.vue and show loader when data is loading but when data is loaded then i want to use: this.$router.push("admin/dashboard") to redirect to another page where this data is displayed, my code: const actions = { fetchData({ commit },{ id}) { return axios.get(`someUrl?hd=${id}`) .then(response => { if(response.status == 200) { commit('setData', response.data), } })

How to check if data is returned from api?

谁都会走 提交于 2021-02-05 07:12:24
问题 How to check if my api request returns me any data from fetchData function?, I want to return boolean (or something else) to my Index.vue and show loader when data is loading but when data is loaded then i want to use: this.$router.push("admin/dashboard") to redirect to another page where this data is displayed, my code: const actions = { fetchData({ commit },{ id}) { return axios.get(`someUrl?hd=${id}`) .then(response => { if(response.status == 200) { commit('setData', response.data), } })

How to check if data is returned from api?

孤人 提交于 2021-02-05 07:12:04
问题 How to check if my api request returns me any data from fetchData function?, I want to return boolean (or something else) to my Index.vue and show loader when data is loading but when data is loaded then i want to use: this.$router.push("admin/dashboard") to redirect to another page where this data is displayed, my code: const actions = { fetchData({ commit },{ id}) { return axios.get(`someUrl?hd=${id}`) .then(response => { if(response.status == 200) { commit('setData', response.data), } })