Vue.js

Vue + Typescript - Import errors with class based decorators

随声附和 提交于 2021-01-29 07:31:19
问题 I'm trying to set up Vue 3 with TypeScript and class-based components. However, I keep getting on error on importing the Component decorator the Vue constructor: This expression is not callable. Type 'typeof import("/Users/*folder*/node_modules/vue-class-component/dist/vue-class-component")' has no call signatures. Vetur(2349) mycode.vue: <script lang="ts"> import Vue from 'vue' import Component from 'vue-class-component' @Component // 1st Error '@Component' export default class ProdItem

Vue 3 Composition API reuse in multiple components

廉价感情. 提交于 2021-01-29 07:29:12
问题 I have these files App.vue, Header.vue, search.js and Search.vue App.vue is normal and just adding different views Header.vue has an input box <input type="text" v-model="searchPin" @keyup="searchResults" /> <div>{{searchPin}}</div> and script: import useSearch from "@/compositions/search"; export default { name: "Header", setup() { const { searchPin, searchResults } = useSearch(); return { searchPin, searchResults }; } }; search.js has the reusable code import { ref } from "vue"; export

How to add custom custom product filter in vue-storefront

喜你入骨 提交于 2021-01-29 07:28:54
问题 I have a question: how to implement additional filter to the vue-storefront product items filters? There are 4 filters (colors, Erin Recommends, price, size) in the default category sidebar and I want to add my custom filter, for example "brand", but I have no idea how to do this. There are nothing useful I could find in the internet, this is official documentation, but this is not enough. Can someone provide the manual or some documentation? Thanks. 回答1: Make sure you have new attribute in

Specify Vuex Store To Use In Component

巧了我就是萌 提交于 2021-01-29 07:26:28
问题 I have modularized my Vuex store and need child-components to be able to access data/use the same stores as their parent component. Here's what I've tried: <!-- ParentOne.vue --> <template> <div> <child-component vuex-store="services/opportunities" /> </div> </template> <script> import ChildComponent from '@/components/services/child-components/ChildComponent'; import { mapActions, mapState, mapGetters } from 'vuex'; export default { components: { 'child-component': ChildComponent, },

Vue.js apollo graphql sends request to localhost instead to certain endpoint

落花浮王杯 提交于 2021-01-29 07:15:35
问题 I configured a multiclient vue apollo, but for some reason it sends requests only to localhost. However I never specified a localhost endpoint. Here is my config file vue-apollo.js: import Vue from "vue"; import VueApollo from "vue-apollo"; import { createApolloClient, restartWebsockets } from "vue-cli-plugin-apollo/graphql-client"; Vue.use(VueApollo); const AUTH_TOKEN = "apollo-token"; const httpsEndpoint = process.env.VUE_APP_GRAPHQL_HTTPS || "https://myst.endpoint.prod/graphql"; export

How to access individual elements from a prop object in Vue

我们两清 提交于 2021-01-29 07:08:23
问题 I am new to Vue and studied the other questions here and can not seem to work out how to pass an object to a child component and reference individual elements of that object. I want all elements of the object to be able to be individually accessed and used in the footer template where appropriate. I am using NPM from node-js and run the dev with npm run dev In my root component, App.Vue, I have as follows: (unrelated lines omitted) <template> <div> <router-view></router-view> <bbay-footer v

How to improve touchmove performance @Android/Chrome?

笑着哭i 提交于 2021-01-29 07:07:47
问题 I'm developing a custom drag UI using touch events. When there is a scrollbar on the page, Chrome Android touchmove performance is abysmal, the event will only fire a couple times per second which results in extremely jerky dragging. The problem won't reproduce when there is no scrollbar or when testing using Chrome devtools emulator. Adding touch-events: none; CSS property helps with the issue but also prevents native scrolling from happening inside the container so using this approach will

Laravel 7 and VueJs Vue Multiselect Noob Question

百般思念 提交于 2021-01-29 07:01:09
问题 I am a totally noob at laravel and npm and vuejs things. I made a new Laravel Project and instead of playing around with jquery I want to learn how to use vuejs. I ran against a wall today :( trying 2 days to get this Multiselect (https://vue-multiselect.js.org/#sub-select-with-search) running on my project. I think I am missing some basics ... What I've done: ran on terminal npm install vue-multiselect created in resources/js/comonents/Multiselect.vue pasted this code in /Multiselect.vue:

Vue - Calling store getter after dispatch completes?

烂漫一生 提交于 2021-01-29 06:57:47
问题 I'm using Laravel 5.7 + Vue2 + Vuex I am having some difficulty getting Vue to return a store value after my dispatch call completes. My application flow looks like this: I click a submit button which calls validate() on the component. Validate() dispatches to my "addLease" action which calls the store api in a Laravel controller. Laravel validates the data and returns a response with errors, or a success message. A commit is then performed to update the leaseStore state with the appropriate

Unable to add data to custom User collection properly in Firestore

亡梦爱人 提交于 2021-01-29 06:49:10
问题 Problem I'd like to add several user data to firestore Authenticateced user list AND to users collection which I created by myself at same time, but it does't go well. users collection are updated only its part of it. Data // javascript users: [ {email: "n_0@example.com", username: "user0"}, {email: "n_1@example.com", username: "user1"}, {email: "n_2@example.com", username: "user2"}, {email: "n_3@example.com", username: "user3"}, {email: "n_4@example.com", username: "user4"} ] Code //