<div id="app">
<svg width="400" height="300">
<rect @click="toggleStroke" x="10" y="10" :width="width" :height="height" :fill="color" stroke="green" :stroke-width="stroke"></rect>
</svg>
</div>
new Vue({
el: '#app',
data: {
color: 'orange',
width: 100,
height: 100,
stroke: 0
},
methods: {
toggleStroke(){
this.stroke == 0 ? this.stroke = 5 : this.stroke = 0
}
}
})
View Compiled
This Pen doesn't use any external CSS resources.