-
package.json
Open in GitHub{ // "dependencies": { "alpinejs": "^2.8.0", "axios": "^0.21.1", "websocket-driver": "^0.7.4" } }
-
resources/views/layouts/app.blade.php
Open in GitHub// <a x-on:click="click()" @click.away="clickAway()" class="nav-link" href="#" > <i class="fas fa-bars"></i> </a> //
-
resources/js/app.js
Open in GitHubimport "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; } }, }; }, }; //