Alpine.js ti offre la natura reattiva e dichiarativa di grandi framework come Vue o React a un costo molto inferiore. La sua forza sta nella facilità di manipolazione del DOM (document object model).
Alpine.js non prevede alcun build step e fornisce tutti gli strumenti necessari per creare un'i...
Alpine.js ti offre la natura reattiva e dichiarativa di grandi framework come Vue o React a un costo molto inferiore. La sua forza sta nella facilità di manipolazione del DOM (document object model).
Alpine.js non prevede alcun build step e fornisce tutti gli strumenti necessari per creare un'interfaccia utente di base.
Size: 2.82 MB
Language: en
Added: Feb 25, 2022
Slides: 23 pages
Slide Content
PRIMARY
#2D3442
SECONDARY
#F90032
TERTIARY
#F3F3F3
use for text creation and items such as shapes and forms only use shapes and background items
delete this slide after read or if you don't need it
State (JavaScript data that Alpine watches for changes)
How alpine.js work?
<section x-data="{ open: false }">
<button @click.prevent="open = !open">
Toggle button
</button>
<p x-ignore>
Whathever you write here is ignored by Alpine.js lifecycle
</p>
</div>
</section>
Alpine is a collection of
●18 attributes
●9 magic properties
●3 global methods
Let’s check the docs together
Documentation
Documentation showcase
Official must to use plugins
Feature name NPM package name Alpine feature
intersection observer @alpinejs/intersect x-intersect
persist @alpinejs/persist
Save the Alpine.Store into the
localStorage
focus @alpinejs/focus x-trap
collapse @alpinejs/collapse x-collapse
Adding a new “Component”
window.myTabs = () => ({
selectedTab: 0,
setTabIndex: (i) => {
this.selectedTab = i
},
init: (i = 0) => {
this.setTabIndex(i)
}
})
Pro
●No bundlers needed
●Easy to use
●Near to Vue syntax
●It simplify the work on
small projects
Cons
●No SPA/Routing support
●It requires discipline
(to avoid spaghetti code)
●Is not a magic wand
Pro and cons table