vue-component

Vue.js error : Cannot read property '_parent' of undefined(…)

喜你入骨 提交于 2019-12-25 04:25:42
问题 i am trying to use Vue.js global event bus. Here is my code. I checked lots of examples which are working fine but when i try to use the same idea to code for my project it's showing this Error: Cannot read property '_parent' of undefined(…) var bus = new Vue() Vue.component('login', { template: "#login", data: function(){ return { ip:'', sessiontoken:'' } }, ready: function(){ this.settoken(); this.getip(); }, methods: { getencrypteduser:function(){ }, getauthentifications: function(event){

How to pass props in vue router

孤者浪人 提交于 2019-12-25 01:46:38
问题 Hi guys i been trying to pass props in vue routes so far i was able to achieve this below, but is not what i wanted. So far this works route.js { path: '/register/', name: 'register', component: require('./views/Login').default, } home.vue <router-link tag="li" :to="{ name: 'register', params: { isRegisteringMe: 'true' }}" class="btn btn-green m-top-20 menu-btn" v-show="!isLoggedIn">Register</router-link> And in register.vue i can console.log(this.$route.params.isRegisteringMe); which will

How can I set default parameter value in Vue.js method function?

落爺英雄遲暮 提交于 2019-12-25 01:14:24
问题 I am trying to set a default parameter value for a function in one of my component methods like: methods: { myFuntion: function(isAction = false) {} } But when debug the value of isAction I get a "MouseEvent"? 回答1: If you call your method like below, it will implicitly pass the event object: <button @click="myFuntion">Default Action</button> <!-- isAction will be event --> If you don't need the event object, just add the parenthesis to the method name: <button @click="myFuntion()">Default

I'm losing data after clicking on About page in Vue

邮差的信 提交于 2019-12-25 00:55:21
问题 I have a Vue router installed and two pages: Home and About . All is working, but when I click to About page and then back, data from Home page is gone. Page not reloading, I'm just moving between routed pages. Props are passed to the component. Where is a mistake? Why data doesn't save in component after clicking About page? 回答1: This problem has been solved. Vuex was used. 来源: https://stackoverflow.com/questions/57240303/im-losing-data-after-clicking-on-about-page-in-vue

How to preload variables in a component style

霸气de小男生 提交于 2019-12-25 00:54:54
问题 So I successfully configure webpack for loading scss style that is in my components. I use a <style lang="scss"></style> and it goes well. I used the vue-cli with the webpack installation. But I would need to call some of my scss variables from there, so I guess I would need a kind of preload? Is there a way to do it without having to @import in each component? 回答1: You need sass-resources-loader . The solution is provided in vue-loader's official document. Please check the section named

How can I set layout row in dialog vuetify?

纵然是瞬间 提交于 2019-12-25 00:35:41
问题 I have a problem in the layout. Look at this : https://codepen.io/positivethinking639/pen/YzzwYZq. when the dialog appears, it looks strange. because the width of the row(<v-row justify="center"> ) is bigger than the width of the dialog . so when the modal dialog appears like there are 2 shadows. I want width of the row( <v-row justify="center"> ) is same with the width of the dialog I had try it. But I did not find a solution. hope someone helps 回答1: set your dialog to use auto width .v

Dynamic tables using indexes of arrays instead of key/value pairs?

早过忘川 提交于 2019-12-24 22:53:11
问题 I have large datasets that I’ve already had to map to entirely new schemas twice to support exporting to various stringent document formats, so I’d like to avoid having to reformat the data structure again to support data tables. The data table component uses an array of values for the header and then an array of objects for the data. I’m stuck with using an array of arrays with the headers and data identified by the index. data() { return { tableData = { [{value:'columnHeader1',type:'string'

Get data from local json file in Vuejs method using jQuery $.getJSON()

送分小仙女□ 提交于 2019-12-24 22:11:20
问题 I'm working on a demo app using Vuejs, and as part of it, I need to get some map data from a local .json file, get certain parts of it (such as lat/long values), and then put it into the appropriate data objects so they can be displayed on a map. After doing a lot of searching it seems that the easiest way it to use jQuery's $.getJSON() method. However, what I can't figure out is how to get the data from within the $.getJSON callback to my Vue markers object. Here's my relevant code: <script>

Passing an entire object via props not working in Vue.js while passing a single member works

故事扮演 提交于 2019-12-24 21:20:55
问题 I'm currently working on some practice code where you can fetch some detailed card data by clicking one of the displayed buttons. I implemented the "show the detailed card info" function which gets triggered when you click one of the orange buttons by the following code, <div v-for="(obtainedCardInfo, index) in obtainedCardsInfo"> <span v-if="cardBtnChosen && card.id == selectedCard && obtainedCardInfo.id == selectedCard"> <span class="cardInfo">DETAILED CARD INFO:</span> <div class=

how to use “v-for” for adding or removing a row with multiple components

丶灬走出姿态 提交于 2019-12-24 21:03:55
问题 i have a row with 3 components(in which is a defined component 1, component 2 and component 3, as showed in my previous question: VueJs component undefined ) how can i add a row or remove a row (in which has 3 components) using v-for? var data1={selected: null, items:["A", "B"]}; Vue.component('comp1', { template: `<select v-model="selected"> <option disabled value="">Please select</option> <option v-for="item in items" :value="item">{{item}}</option> </select>`, data:function(){ return data1