Answer the question
In order to leave comments, you need to log in
Pass value from mounted to data Vue.js?
new Vue({
el: '#app',
data: {
users: [{ name: '',procent:'' }],
},
methods: {
addUser(index) {
var vm = this
const attrValue = this.$refs.div.getAttribute('data-bullshit-attribute');
const attrValue2 = this.$refs.div2.getAttribute('data-lastnum-attribute');
console.log(attrValue2)
length=this.users.length
length2=length+parseInt(attrValue2);
this.users.push({
name: '',
procent: attrValue + '/'+(length+1),
});
},
deleteUser: function (index) {
console.log(index);
console.log(this.finds);
this.users.splice(index, 1);
if(index===0)
this.addUser()
},
},
mounted: function () {
const attrValue2 = this.$refs.div2.getAttribute('data-lastnum-attribute');
//procent:1,
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question