Skip to content

Commit 5de0b3a

Browse files
committed
add an update number method to show how it doesnt run per update but uses the debounce
1 parent 225c016 commit 5de0b3a

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

demo/src/pages/Home.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,41 @@
1111
<router-link to="/contact">Contact</router-link>
1212
</li>
1313
</ul>
14+
<p>Number: {{num}}</p>
15+
<p>Each time the number updates it's running a debounce function to call `axe-core` again.<br />It will only run run the debounce once per 5 seconds or 1 second after the last call.</p>
1416
</div>
1517
</template>
1618

1719
<script>
1820
import Logo from '@/components/Logo'
19-
21+
2022
export default {
2123
name: 'Home',
2224
components: {
2325
Logo
2426
},
2527
data () {
2628
return {
27-
msg: 'Welcome - Open your console'
29+
msg: 'Welcome - Open your console',
30+
num: 0
31+
}
32+
},
33+
mounted()
34+
{
35+
this.updateNumber();
36+
},
37+
methods: {
38+
updateNumber()
39+
{
40+
setTimeout(() => {
41+
this.num += 1;
42+
this.updateNumber();
43+
}, 500);
2844
}
2945
}
3046
}
3147
</script>
3248

3349
<style scoped>
3450
35-
</style>
51+
</style>

0 commit comments

Comments
 (0)