how to access refs in methods in vuejs
I want to access template ref in functions inside method objects. Currently, it throws undefined when accessing the refs.
My Code Below:
-
$4M
And My Code in Script tag is below:
export default {
methods: {
getMileStonePercent(num, secWrp) {
let ele = this.$refs[secWrp]
return ele.offsetWidth + '%'
},
},
created() {},
}
Kindly, provide solution to get the width by accessing the template reference in my function. Thanks in advance.