package.json
{ // "dependencies": { "alpinejs": "^2.8.0", "axios": "^0.21.1", "websocket-driver": "^0.7.4" }}
{ // "dependencies": { "alpinejs": "^2.8.0", "axios": "^0.21.1", "websocket-driver": "^0.7.4" }}
// ... <a x-on:click="click()" @click.away="clickAway()" class="nav-link" href="#"> <i class="fas fa-bars"></i></a> // ...
import "alpinejs"; window.axios = require("axios"); window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; var nav = { width: 990, make() { return { // click() { this.collapsed = !this.collapsed; if (!this.collapsed) { this.$refs.body.classList.add("sidebar-open"); } else { this.$refs.body.classList.remove("sidebar-open"); } }, clickAway() { if (window.innerWidth < this.width) { this.$refs.body.classList.remove("sidebar-open"); this.collapsed = true; } }, }; },};//