vuejs2

Renderless Vue Component in TypeScript

孤街浪徒 提交于 2021-01-27 08:50:18
问题 I have a renderless component in JavaScript that I am trying to convert to TypeScript. I'm running into errors declaring the render function in a Vue.extend -ed component: (method) ComponentOptions<Vue, unknown, unknown, unknown, never[], Record<never, any>>.render?(createElement: CreateElement, hack: RenderContext<Record<never, any>>): VNode No overload matches this call. The last overload gave the following error. Argument of type '{ render(): void; }' is not assignable to parameter of type

Every second Vuex commit to the same action is slow

徘徊边缘 提交于 2021-01-27 07:31:55
问题 I am using Vuex V3.0.1 with Vue.js v 2.5.17 The same action commit in vuex is slow exactly every second time. If I put the same axios request inside my component and call it from within the component, it is consistently between 16 and 22 ms. When I however dispatch to the store, every second request is consistently over 300ms. this.$store.dispatch('getQueryData', {QueryId: this.to.QueryId, params: data, CacheResults : this.to.CacheResults }).then(response => { this.options = response.data var

Every second Vuex commit to the same action is slow

寵の児 提交于 2021-01-27 07:29:07
问题 I am using Vuex V3.0.1 with Vue.js v 2.5.17 The same action commit in vuex is slow exactly every second time. If I put the same axios request inside my component and call it from within the component, it is consistently between 16 and 22 ms. When I however dispatch to the store, every second request is consistently over 300ms. this.$store.dispatch('getQueryData', {QueryId: this.to.QueryId, params: data, CacheResults : this.to.CacheResults }).then(response => { this.options = response.data var

In Vue.js, How to find what data changes cause a component to re-render?

冷暖自知 提交于 2021-01-27 07:13:05
问题 In Vue.js, a component does re-render(update) when some data changes. Sometimes the re-render frequency is too often and i want to find out which data's change cause this re-render. How to find out the changed data causing the re-render? 回答1: Using deep-diff and a simple watcher, you can easily find the difference between a previous copy of your vm data. new Vue({ el: "#app", data: { counter: 0 }, mounted() { let oldData = JSON.parse(JSON.stringify(this.$data)); this.$watch(vm => vm.$data,

Local search v-data-table Vuetify

久未见 提交于 2021-01-27 06:50:56
问题 I've got an array of objects: productos[] , I use this to populate the v-datatable . I've been trying to add the search texfield such as the Vuetify documentation says. I've added this but it only works (for some reason) with the headers that has numbers and it doesn't work for example when you type a string. I think i'm doing something wrong. Search textfield: <v-text-field v-model="search" append-icon="search" label="Search" single-line hide-details ></v-text-field> v-datatable <v-data

Vue.js - change undefined img source that I have created dynamically

徘徊边缘 提交于 2021-01-27 06:00:40
问题 I am playing around with vue js and with a 3rd party API. I have succeeded in fetching the json data and presenting it in my html but I am struggling with the images. Some images are missing from the json file so i have stored them locally in my laptop. I have tried to set empty images source using v-if in my html without luck. (see the comments in my html file) Also I have tried to assign a class for every img and then I tried to set an img source using jquery $("#zTTWa2").attr("src",

Overriding a component method

删除回忆录丶 提交于 2021-01-27 05:38:32
问题 I'm using VueCharts which is a Google Charts plugin for vue. I'm trying to give the newer Material Design looks to the charts. I've tried passing "google.charts.Bar" to chart-type prop and it did work. However, many of the options are ignored because, as stated in the Google Charts docs, the options object needs to be converted by using google.charts.Bar.convertOptions(options) , something the plugin doesn't do. Looking at the source, the plugin installs a 'vue-chart' component. This

Vue.js bind to DOM custom event with dots in name (like bootstrap events)

我是研究僧i 提交于 2021-01-27 05:33:18
问题 Using Vue 2.1.10 I can bind to DOM events with v-on directive. For example: v-on:click To bind to DOM click. But I can't figure how to bind to an event that has dots in the name. such as "show.bs.modal" from bootstrap. Currently, I use a workaround binding in the created hook with Regular DOM Methods, but I really would like to use the declarative syntax for that. How can this be achieved? thanks EDIT: The question is about allowed syntax: how can I do something like: Vue.component('comp',{

Vuetifyjs error Unknown custom element: did you register the component correctly

给你一囗甜甜゛ 提交于 2021-01-27 05:25:46
问题 Am using vuetify to build a template but am getting an error unknown custom element dashboard did you register the component correctly? This is my code: In the main.js import Vue from 'vue' import App from './App.vue' import Vuetify from 'vuetify' import VueRouter from 'vue-router'; import {routes} from './routes'; Vue.use(VueRouter); Vue.use(Vuetify) new Vue({ el: '#app', render: h => h(App) }) In my App.vue <template> <dashboard></dashboard> </template> <script> import Dashbaord from '.

How to change style of background color using Vue.js only

放肆的年华 提交于 2021-01-27 04:46:29
问题 import Vue from 'vue' import App from './App' import BootstrapVue from 'bootstrap-vue' import 'bootstrap/dist/css/bootstrap.css' import 'bootstrap-vue/dist/bootstrap-vue.css' Vue.config.productionTip = false Vue.use(BootstrapVue); /* eslint-disable no-new */ new Vue({ el: '#app', components: { App }, template: '<App/>' }) <template> <div id="app"> <webpage></webpage> </div> </template> <script> import webpage from "./components/webpage" export default { name: 'app', components : { webpage } }