vue-component

Vue js - pass data within two components in the same level

假装没事ソ 提交于 2021-01-27 12:55:23
问题 I have data that I need to pass from one component1 to another component2 . I don't use vuex or router . Components tree: -Parent --Component1 --Component2 From first component1 I make ajax request, retrieving info and pushing to data. board: [1,2,3,4,5] And I need access that retrieved data in component2 Can I do It without vuex or router ? Thank you :) 回答1: You could emit an event to parent from component1 having as parameters the updated board and in the parent one receive that and pass it

Vue JS provide/inject and Props

本秂侑毒 提交于 2021-01-27 12:24:13
问题 When should provide/inject be used compared to props. In my opinion props make component more meaningful. Provide/inject makes components tightly coupled. What are the use cases where using provide/inject is a better approach. Please advice Thanks 回答1: Here are some differences that helped me choose in many situations props are reactive and provide / inject is not. props can only be used on direct child components. From docs: Provide / inject are used together to allow an ancestor component

Renderless Vue Component in TypeScript

谁都会走 提交于 2021-01-27 08:51:31
问题 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

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

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",

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 enhance an existing Laravel project with VueJS?

泪湿孤枕 提交于 2021-01-27 05:21:53
问题 I just finished my project using only the Laravel framework. Now I want to add vue.js into my project to render the views without loading them. I went through some tutorials and found that I need to convert my blade files into Vue components to achieve this. But as I know it's a big process as some of the functions won't work in VueJS. And I don't know how to do it. Please, someone, guide me here on how to do that. Thanks in advance. 回答1: Rebuild your basic structure into a Vue template: //

How to enhance an existing Laravel project with VueJS?

大憨熊 提交于 2021-01-27 05:19:08
问题 I just finished my project using only the Laravel framework. Now I want to add vue.js into my project to render the views without loading them. I went through some tutorials and found that I need to convert my blade files into Vue components to achieve this. But as I know it's a big process as some of the functions won't work in VueJS. And I don't know how to do it. Please, someone, guide me here on how to do that. Thanks in advance. 回答1: Rebuild your basic structure into a Vue template: //

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 } }