Skip to content

Commit

Permalink
example: first version if-statement
Browse files Browse the repository at this point in the history
  • Loading branch information
sebkolind committed Nov 22, 2023
1 parent 22bf7ad commit 45a9f1c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
22 changes: 22 additions & 0 deletions example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,25 @@ one({
})
}
})

one({
name: 'test',
setup ({ query }) {
const conditional1 = query('p')
const conditional2 = query('div')
const btn = query('button')
const btn2 = query('button#show')

const cond1 = conditional1.if()
const cond2 = conditional2.if()

btn.on('click', () => {
cond1.hide()
cond2.hide()
})
btn2.on('click', () => {
cond1.show()
cond2.show()
})
}
})
6 changes: 6 additions & 0 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
<a href="./robots.txt" aria-label="robots.txt"></a>
<my-component msg="Hi, from a prop!"></my-component>
<my-component variant="sec"></my-component>
<test>
<p>Hejsa</p>
<div>Hejsa 2</div>
<button>Click to hide</button>
<button id="show">Click to show</button>
</test>
<script type="module" src="app.js"></script>
</body>
</html>

0 comments on commit 45a9f1c

Please sign in to comment.