1.0.2 • Published 5 years ago
item-selector v1.0.2
item-selector
web component for selecting products and adding them to cart
Possible attributes:
- id
- item-id
- item-link
- height
- width
- img-src
- router-type
Custom events:
- select-item
- deselect-item
Installation
npm i item-selector
Usage
<!Doctype html>
<html>
<head>
<title>title</title>
</head>
<body>
<item-selector selected="true" height="225px" width="200px" img-src="./img/item.png">
</body>
<script>
document.querySelector("item-selector")
.addEventListener("select-item", add);
document.querySelector("item-selector"
).addEventListener("deselect-item", remove);
function add() {console.log("product is selected")}
function remove() { console.log("product is unselected")}
</script>
</html>``