Skip to content

Commit adaac9c

Browse files
authored
feat: ignore clicks if directive value is falsy (#243)
closes #242
1 parent 3dd7bb8 commit adaac9c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/directive.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ function getBinding(el) {
3939
}
4040

4141
function handleClick(e) {
42+
const ctx = getBinding(this).binding
43+
if (!ctx.value) return
44+
4245
e.preventDefault()
43-
let ctx = getBinding(this).binding
4446

4547
if (typeof ctx.value === 'string') {
4648
return scrollTo(ctx.value)

0 commit comments

Comments
 (0)