Reputation: 2187
could you please help me with resolve problem, why compiler say, that function 'show' is defined but never used?
function show is use in html:
<b-card>
<div id="draw-image-test">
<canvas
id="canvasId"
ref="canRef"
@mousemove="show"
/>
</div>
</b-card>
And after <script>
function show(){
const canvasMouseTrack = document.getElementById('canvasId')
const rect = canvasMouseTrack.getBoundingClientRect()
console.log(rect.offsetX)
}
And i have error:
'show' is defined but never used no-unused-vars
Upvotes: 0
Views: 34
Reputation: 1
the function show
should be added to the methods
option :
<script>
export default{
methods:{
show:function(){
const canvasMouseTrack = document.getElementById('canvasId')
const rect = canvasMouseTrack.getBoundingClientRect()
console.log(rect.offsetX)
}
}
}
Upvotes: 1