WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 5ef118f

Browse files
committed
Upgrade version && write docs for x-init
1 parent 6c9a7e7 commit 5ef118f

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Think of it like [Tailwind](https://tailwindcss.com/) for JavaScript.
1212

1313
**From CDN:** Add the following script to the end of your `<head>` section.
1414
```html
15-
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v1.2.0/dist/alpine.js" defer></script>
15+
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v1.3.0/dist/alpine.js" defer></script>
1616
```
1717

1818
That's it. It will initialize itself.
@@ -82,11 +82,12 @@ You can even use it for non-trivial things:
8282

8383
## Learn
8484

85-
There are 11 directives available to you:
85+
There are 12 directives available to you:
8686

8787
| Directive
8888
| --- |
8989
| [`x-data`](#x-data) |
90+
| [`x-init`](#x-init) |
9091
| [`x-show`](#x-show) |
9192
| [`x-bind`](#x-bind) |
9293
| [`x-on`](#x-on) |
@@ -145,6 +146,15 @@ You can also mix-in multiple data objects using object destructuring:
145146

146147
---
147148

149+
### `x-init`
150+
**Example:** `<div x-data"{ foo: 'bar' }" x-init="foo = 'baz"></div>`
151+
152+
**Structure:** `<div x-data="..." x-init="[expression]"></div>`
153+
154+
`x-init` runs an expression (with the initial data object in scope) when a component is initialized.
155+
156+
---
157+
148158
### `x-show`
149159
**Example:** `<div x-show="open"></div>`
150160

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"main": "dist/alpine.js",
33
"name": "alpinejs",
4-
"version": "1.2.0",
4+
"version": "1.3.0",
55
"repository": {
66
"type": "git",
77
"url": "git://github.com/alpinejs/alpine.git"

0 commit comments

Comments
 (0)