Skip to content

Commit 9541c23

Browse files
migrate vanilla JS to mounted function
1 parent 5542b21 commit 9541c23

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/App.vue

+14
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,20 @@ export default {
113113
this.$nextTick(() => {
114114
window.addEventListener('resize', this.onResize);
115115
});
116+
117+
const exploreButton = document.querySelector('button.explore');
118+
const explorePanel = document.querySelector('.explore-panel');
119+
120+
exploreButton.addEventListener('click', (event) => {
121+
explorePanel.classList.toggle('expand');
122+
});
123+
124+
const menuButton = document.querySelector('button.expand-menu');
125+
const menuPanel = document.querySelector('.primary-menu');
126+
127+
menuButton.addEventListener('click', (event) => {
128+
menuPanel.classList.toggle('expand');
129+
});
116130
},
117131
beforeDestroy() {
118132
window.removeEventListener('resize', this.onResize);

src/main.js

-13
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,3 @@ if(process.env.VUE_APP_CC_OUTPUT!=='embedded') {
2929

3030
export default App;
3131

32-
const exploreButton = document.querySelector('button.explore');
33-
const explorePanel = document.querySelector('.explore-panel');
34-
35-
exploreButton.addEventListener('click', (event) => {
36-
explorePanel.classList.toggle('expand');
37-
});
38-
39-
const menuButton = document.querySelector('button.expand-menu');
40-
const menuPanel = document.querySelector('.primary-menu');
41-
42-
menuButton.addEventListener('click', (event) => {
43-
menuPanel.classList.toggle('expand');
44-
});

0 commit comments

Comments
 (0)