It adds the required scripts for the
Alpine.js library to your MyBB theme and enables you to use the
Alpine.js magics (
$el, $refs, $store, ...
) that are not allowed by the MyBB 1.8 theme engine.
Details
Version: 2.0.0
MyBB Versions: 1.8.x
Install
1. Download the plugin.
2. Upload the files in the "Upload" folder to the root directory of your forum with SCP (
scp
command.) or FTP (FileZilla, CuteFTP, etc.).
3. Install and activate the plugin named Alpine.js from the Admin CP → Configuration → (From left.) Plugins page.
Uninstall
1. Uninstall the plugin named Alpine.js from the Admin CP → Configuration → (From left.) Plugins page.
Update
1. First, perform the "Uninstall" section, then perform the "Install" (with new files) section.
Usage
You can review the
Alpine.js documentation page for usage.
The variables you will use in templates for Alpine.js magics are as follows:
$el
→
{$alpinejs['el']}
$refs
→
{$alpinejs['refs']}
$store
→
{$alpinejs['store']}
$watch
→
{$alpinejs['watch']}
$dispatch
→
{$alpinejs['dispatch']}
$nextTick
→
{$alpinejs['nextTick']}
$root
→
{$alpinejs['root']}
$data
→
{$alpinejs['data']}
$id
→
{$alpinejs['id']}
Example:
$el.innerHTML
=
<button @click="{$alpinejs['el']}.innerHTML = 'Hello World!'">Replace me with "Hello World!"</button>
Happy Coding!