4👍
✅
Firstly, you should use ref="svglink"
instead of id="svglink"
if you want to use a ref.
However, there’s a better way than this by using reactive properties.
<template>
<a id="svglink" :href="url" @click="saveSvg2" download="testSvg.svg" >EXPORT SVG</a>
</template>
<script>
export default {
data() {
return {
url: ''
}
},
mounted() {
// whenever you update this.url the link will update
// doesn't have to be in mounted(), this is just an example
this.url = 'http://example.com'
}
}
</script>
Source:stackexchange.com