vue-component

File input on change in vue.js

微笑、不失礼 提交于 2021-02-15 08:20:39
问题 Using plain HTML/JS, it is possible to view the JavaScript File objects of selected files for an input element like so: <input type="file" id="input" multiple onchange="handleFiles(this.files)"> However, when converting it to the 'Vue' way it doesn't seem to work as intend and simply returns undefined instead of returning an Array of File objects. This is how it looks in my Vue template: <input type="file" id="file" class="custom-file-input" v-on:change="previewFiles(this.files)" multiple>

this.$refs[(“p” + index)].focus is not a function

左心房为你撑大大i 提交于 2021-02-15 06:18:24
问题 I'd like to turn a div into input box on click, so that the post (which is rendered inside a loop) can be edited. Here is the button on the post: <a @click="setFocusEdit(index)" v-if="isAuthor(post)" href="#" >Edit Me</a> And the div concerned: <div :ref="'p' + index" class="post-description"> {{post.description}} </div> The method: setFocusEdit(index) { console.log('focusing on', index); this.$refs['p' + index].focus(); }, But I get this error: Uncaught TypeError: this.$refs[("p" + index)]

this.$refs[(“p” + index)].focus is not a function

ぐ巨炮叔叔 提交于 2021-02-15 06:18:20
问题 I'd like to turn a div into input box on click, so that the post (which is rendered inside a loop) can be edited. Here is the button on the post: <a @click="setFocusEdit(index)" v-if="isAuthor(post)" href="#" >Edit Me</a> And the div concerned: <div :ref="'p' + index" class="post-description"> {{post.description}} </div> The method: setFocusEdit(index) { console.log('focusing on', index); this.$refs['p' + index].focus(); }, But I get this error: Uncaught TypeError: this.$refs[("p" + index)]

What is affecting on will Vue computed property re-computed or no?

£可爱£侵袭症+ 提交于 2021-02-11 12:38:02
问题 I expect that currentSelectionViewContent will be re-computed each time when selectedOptionsIndexes has changed. Really, sometimes it works, sometimes - not. import { Component, Prop, Vue, Watch } from "vue-property-decorator"; @Component({ template }) export class SelectField extends Vue { private onNewOptionSelected(newOption: SelectField.Option, indexInArray: number): void { console.log("~~~~~~~~~~~~~~~"); console.log(JSON.stringify(this.selectedOptionsIndexes, null, 2)); this

Access data from another Component

谁说我不能喝 提交于 2021-02-11 08:27:49
问题 now i have 2 Components 1 - is just a drop down list v-select <v-row align="center" > <v-col class="d-flex" cols="12" sm="6" v-if="Compounds" > <v-select :items="Compounds" v-model="selectedItems" label="Select" item-value="id" item-text="name" v-on:change="selectedCompound"> </v-select> {{ selectedItems }} </v-col> </v-row> with method methods: { selectedCompound(h2o) { console.log(h2o); console.log("This is from Selected Compound"); }, and i call it in another page <div> <SelectCompound><

Retrieve data from an API and pass them in a Vuetify table

自闭症网瘾萝莉.ら 提交于 2021-02-11 06:11:32
问题 I was assigned to do this project as part of my application for a Junior Developer position. I have never worked on Vue.js and they assigned me with this project asking to retrieve JSON data from an endpoint and projecting them in a vuetify table. My main issue is with the vuetify table i can not understand the difference with the normal html table. Moreover i can not understand whether i have to do a small app using html and js files or to use node.js also and work on it. However i did find

Vue Router how to scroll to same hash consecutively

此生再无相见时 提交于 2021-02-11 05:59:34
问题 I'm currently working on a site based on Vue and using Vue Router for routing. My way to handle scroll behavior to anchor links is the following: const router = new VueRouter({ routes, scrollBehavior (to) { if (to.hash) { return { selector: to.hash, offset: { x: 0, y: 140 } } } return { x: 0, y: 0 } } }) And my links are built in the following way: <router-link class="insurance-link d-block" to="#hogar"> <img class="insurance-logo img-fluid" src="@/assets/home-icon.svg"> Hogar </router-link>

VueJS Mixins Methods Direct Call

走远了吗. 提交于 2021-02-10 04:11:49
问题 I'm testing Mixins on VueJS and I have a question. Is there a way to call an event directly from a Mixins without having to assign it in my methods ? MyMixins.js import Vue from 'vue' Vue.mixin({ methods: { Alerta(){ alert('WORK!') } } }) app.vue <template> <button v-on:click="AlertaInterno">test</button> </template> <script> export default{ methods:{ AlertaInterno(){ this.Alerta() } } } </script> The code above works. I was wondering how I could invoke the mixin function directly, something

VueJS Mixins Methods Direct Call

佐手、 提交于 2021-02-10 04:01:46
问题 I'm testing Mixins on VueJS and I have a question. Is there a way to call an event directly from a Mixins without having to assign it in my methods ? MyMixins.js import Vue from 'vue' Vue.mixin({ methods: { Alerta(){ alert('WORK!') } } }) app.vue <template> <button v-on:click="AlertaInterno">test</button> </template> <script> export default{ methods:{ AlertaInterno(){ this.Alerta() } } } </script> The code above works. I was wondering how I could invoke the mixin function directly, something

VueJS Mixins Methods Direct Call

泄露秘密 提交于 2021-02-10 04:01:06
问题 I'm testing Mixins on VueJS and I have a question. Is there a way to call an event directly from a Mixins without having to assign it in my methods ? MyMixins.js import Vue from 'vue' Vue.mixin({ methods: { Alerta(){ alert('WORK!') } } }) app.vue <template> <button v-on:click="AlertaInterno">test</button> </template> <script> export default{ methods:{ AlertaInterno(){ this.Alerta() } } } </script> The code above works. I was wondering how I could invoke the mixin function directly, something