# Alpine.js
![npm bundle size](https://img.shields.io/bundlephobia/minzip/alpinejs)
![npm version](https://img.shields.io/npm/v/alpinejs)
[![Chat](https://img.shields.io/badge/chat-on%20discord-7289da.svg?sanitize=true)](https://alpinejs.codewithhugo.com/chat/)
Alpine.js offers you the reactive and declarative nature of big frameworks like Vue or React at a much lower cost.
You get to keep your DOM, and sprinkle in behavior as you see fit.
Think of it like [Tailwind](https://tailwindcss.com/) for JavaScript.
> Note: This tool's syntax is almost entirely borrowed from [Vue](https://vuejs.org/) (and by extension [Angular](https://angularjs.org/)). I am forever grateful for the gift they are to the web.
## Translated documentation
| Language | Link for documentation |
| --- | --- |
| Arabic | [**التوثيق باللغة العربية**](./README.ar.md) |
| Chinese Simplified | [**简体中文文档**](./README.zh-CN.md) |
| Chinese Traditional | [**繁體中文說明文件**](./README.zh-TW.md) |
| German | [**Dokumentation in Deutsch**](./README.de.md) |
| Indonesian | [**Dokumentasi Bahasa Indonesia**](./README.id.md) |
| Japanese | [**日本語ドキュメント**](./README.ja.md) |
| Portuguese | [**Documentação em Português**](./README.pt.md) |
| Russian | [**Документация на русском**](./README.ru.md) |
| Spanish | [**Documentación en Español**](./README.es.md) |
| Turkish | [**Türkçe Dokümantasyon**](./README.tr.md) |
| Français | [**Documentation en Français**](./README.fr.md) |
| Korean | [**한국어 문서**](./README.ko.md) |
## Install
**From CDN:** Add the following script to the end of your `<head>` section.
```html
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></script>
```
That's it. It will initialize itself.
For production environments, it's recommended to pin a specific version number in the link to avoid unexpected breakage from newer versions.
For example, to use version `2.8.1` (latest):
```html
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.8.1/dist/alpine.min.js" defer></script>
```
**From npm:** Install the package from npm.
```js
npm i alpinejs
```
Include it in your script.
```js
import 'alpinejs'
```
**For IE11 support** Use the following scripts instead.
```html
<script type="module" src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine-ie11.min.js" defer></script>
```
The pattern above is the [module/nomodule pattern](https://philipwalton.com/articles/deploying-es2015-code-in-production-today/) that will result in the modern bundle automatically loaded on modern browsers, and the IE11 bundle loaded automatically on IE11 and other legacy browsers.
## Use
*Dropdown/Modal*
```html
<div x-data="{ open: false }">
<button @click="open = true">Open Dropdown</button>
<ul
x-show="open"
@click.away="open = false"
>
Dropdown Body
</ul>
</div>
```
*Tabs*
```html
<div x-data="{ tab: 'foo' }">
<button :class="{ 'active': tab === 'foo' }" @click="tab = 'foo'">Foo</button>
<button :class="{ 'active': tab === 'bar' }" @click="tab = 'bar'">Bar</button>
<div x-show="tab === 'foo'">Tab Foo</div>
<div x-show="tab === 'bar'">Tab Bar</div>
</div>
```
You can even use it for non-trivial things:
*Pre-fetching a dropdown's HTML content on hover.*
```html
<div x-data="{ open: false }">
<button
@mouseenter.once="
fetch('/dropdown-partial.html')
.then(response => response.text())
.then(html => { $refs.dropdown.innerHTML = html })
"
@click="open = true"
>Show Dropdown</button>
<div x-ref="dropdown" x-show="open" @click.away="open = false">
Loading Spinner...
</div>
</div>
```
## Learn
There are 14 directives available to you:
| Directive | Description |
| --- | --- |
| [`x-data`](#x-data) | Declares a new component scope. |
| [`x-init`](#x-init) | Runs an expression when a component is initialized. |
| [`x-show`](#x-show) | Toggles `display: none;` on the element depending on expression (true or false). |
| [`x-bind`](#x-bind) | Sets the value of an attribute to the result of a JS expression. |
| [`x-on`](#x-on) | Attaches an event listener to the element. Executes JS expression when emitted. |
| [`x-model`](#x-model) | Adds "two-way data binding" to an element. Keeps input element in sync with component data. |
| [`x-text`](#x-text) | Works similarly to `x-bind`, but will update the `innerText` of an element. |
| [`x-html`](#x-html) | Works similarly to `x-bind`, but will update the `innerHTML` of an element. |
| [`x-ref`](#x-ref) | Convenient way to retrieve raw DOM elements out of your component. |
| [`x-if`](#x-if) | Remove an element completely from the DOM. Needs to be used on a `<template>` tag. |
| [`x-for`](#x-for) | Create new DOM nodes for each item in an array. Needs to be used on a `<template>` tag. |
| [`x-transition`](#x-transition) | Directives for applying classes to various stages of an element's transition. |
| [`x-spread`](#x-spread) | Allows you to bind an object of Alpine directives to an element for better reusability. |
| [`x-cloak`](#x-cloak) | This attribute is removed when Alpine initializes. Useful for hiding pre-initialized DOM. |
And 6 magic properties:
| Magic Properties | Description |
| --- | --- |
| [`$el`](#el) | Retrieve the root component DOM node. |
| [`$refs`](#refs) | Retrieve DOM elements marked with `x-ref` inside the component. |
| [`$event`](#event) | Retrieve the native browser "Event" object within an event listener. |
| [`$dispatch`](#dispatch) | Create a `CustomEvent` and dispatch it using `.dispatchEvent()` internally. |
| [`$nextTick`](#nexttick) | Execute a given expression AFTER Alpine has made its reactive DOM updates. |
| [`$watch`](#watch) | Will fire a provided callback when a component property you "watched" gets changed. |
## Sponsors
<img width="33%" src="https://refactoringui.nyc3.cdn.digitaloceanspaces.com/tailwind-logo.svg" alt="Tailwind CSS">
**Want your logo here? [DM on Twitter](https://twitter.com/calebporzio)**
## Community Projects
* [AlpineJS Weekly Newsletter](https://alpinejs.codewithhugo.com/newsletter/)
* [Spruce (State Management)](https://github.com/ryangjchandler/spruce)
* [Turbolinks Adapter](https://github.com/SimoTod/alpine-turbolinks-adapter)
* [Alpine Magic Helpers](https://github.com/KevinBatdorf/alpine-magic-helpers)
* [Awesome Alpine](https://github.com/ryangjchandler/awesome-alpine)
### Directives
---
### `x-data`
**Example:** `<div x-data="{ foo: 'bar' }">...</div>`
**Structure:** `<div x-data="[object literal]">...</div>`
`x-data` declares a new component scope. It tells the framework to initialize a new component with the following data object.
Think of it like the `data` property of a Vue component.
**Extract Component Logic**
You can extract data (and behavior) into reusable functions:
```html
<div x-data="dropdown()">
<button x-on:click="open">Open</button>
<div x-show="isOpen()" x-on:click.away="close">
// Dropdown
</div>
</div>
<script>
function dropdown() {
return {
show: false,
open() { this.show = true },
close() { this.show = false },
isOpen() { return this.show === true },
}
}
</script>
```
> **For bundler users**, note that Alpine.js accesses functions that are in the global scope (`window`), you'll need to explicitly assign your functions to `window` in order to use them with `x-data` for example `window.dropdown = function () {}` (this is because with Webpack, Rollup, Parce
没有合适的资源?快使用搜索试试~ 我知道了~
使用docker搭建私有Nuget服务
共4356个文件
dll:2890个
cs:389个
cache:167个
需积分: 0 0 下载量 8 浏览量
2022-11-14
19:13:23
上传
评论
收藏 158.43MB ZIP 举报
温馨提示
Nuget服务端 netcore代码
资源推荐
资源详情
资源评论
收起资源包目录
使用docker搭建私有Nuget服务 (4356个子文件)
docker-restart.bat 420B
BaGet.Web.TagHelpers.output.cache 337KB
BaGet.csproj.AssemblyReference.cache 217KB
BaGet.csproj.AssemblyReference.cache 211KB
BaGet.Web.csproj.AssemblyReference.cache 182KB
BaGet.assets.cache 111KB
BaGet.assets.cache 111KB
BaGet.assets.cache 98KB
BaGet.Gcp.csproj.AssemblyReference.cache 97KB
BaGet.Protocol.Samples.Tests.csproj.AssemblyReference.cache 96KB
BaGet.Web.csproj.AssemblyReference.cache 96KB
BaGet.Database.Sqlite.csproj.AssemblyReference.cache 95KB
BaGet.Database.MySql.csproj.AssemblyReference.cache 93KB
BaGet.Aws.csproj.AssemblyReference.cache 92KB
BaGet.Web.Tests.csproj.AssemblyReference.cache 92KB
BaGet.Database.SqlServer.csproj.AssemblyReference.cache 92KB
BaGet.Database.PostgreSql.csproj.AssemblyReference.cache 92KB
BaGet.Tests.assets.cache 89KB
BaGet.Tests.csproj.AssemblyReference.cache 84KB
BaGet.Core.Tests.assets.cache 81KB
BaGet.Core.Tests.assets.cache 81KB
BaGet.Protocol.Samples.Tests.assets.cache 76KB
BaGet.Protocol.Samples.Tests.assets.cache 76KB
BaGet.Protocol.Tests.assets.cache 67KB
BaGet.Protocol.Tests.assets.cache 67KB
BaGet.Web.Tests.assets.cache 66KB
BaGet.Azure.assets.cache 54KB
BaGet.Azure.assets.cache 54KB
BaGet.Database.SqlServer.assets.cache 50KB
BaGet.Database.SqlServer.assets.cache 50KB
BaGet.Web.assets.cache 41KB
BaGet.Web.assets.cache 41KB
BaGet.Web.assets.cache 41KB
BaGet.csproj.AssemblyReference.cache 37KB
BaGet.Database.Sqlite.assets.cache 35KB
BaGet.Database.Sqlite.assets.cache 35KB
BaGet.Gcp.assets.cache 35KB
BaGet.Gcp.assets.cache 35KB
BaGetWebApplication.csproj.AssemblyReference.cache 35KB
BaGetWebApplication.assets.cache 34KB
BaGetWebApplication.assets.cache 34KB
project.nuget.cache 31KB
BaGet.Aws.assets.cache 30KB
BaGet.Aws.assets.cache 30KB
BaGet.Database.PostgreSql.assets.cache 30KB
BaGet.Database.PostgreSql.assets.cache 30KB
BaGet.Aliyun.assets.cache 29KB
BaGet.Aliyun.assets.cache 29KB
BaGet.Core.assets.cache 29KB
BaGet.Core.assets.cache 29KB
BaGet.Database.MySql.assets.cache 22KB
BaGet.Database.MySql.assets.cache 22KB
project.nuget.cache 18KB
project.nuget.cache 17KB
project.nuget.cache 17KB
project.nuget.cache 16KB
project.nuget.cache 14KB
project.nuget.cache 13KB
project.nuget.cache 12KB
BaGet.Protocol.Samples.Tests.csproj.AssemblyReference.cache 11KB
project.nuget.cache 11KB
project.nuget.cache 10KB
project.nuget.cache 10KB
project.nuget.cache 10KB
project.nuget.cache 10KB
project.nuget.cache 10KB
BaGet.Core.Tests.csproj.AssemblyReference.cache 9KB
BaGet.Azure.csproj.AssemblyReference.cache 9KB
BaGet.Database.Sqlite.csproj.AssemblyReference.cache 7KB
project.nuget.cache 6KB
BaGet.Database.MySql.csproj.AssemblyReference.cache 6KB
BaGet.Protocol.assets.cache 5KB
BaGet.Protocol.assets.cache 5KB
BaGet.Database.SqlServer.csproj.AssemblyReference.cache 5KB
BaGet.Aliyun.csproj.AssemblyReference.cache 4KB
BaGet.Database.PostgreSql.csproj.AssemblyReference.cache 3KB
BaGet.Aws.csproj.AssemblyReference.cache 3KB
BaGet.Azure.csproj.AssemblyReference.cache 3KB
BaGet.Aliyun.csproj.AssemblyReference.cache 3KB
project.nuget.cache 2KB
BaGet.Core.csproj.AssemblyReference.cache 913B
BaGet.Core.csproj.AssemblyReference.cache 826B
BaGet.Protocol.csproj.AssemblyReference.cache 629B
project.nuget.cache 622B
project.nuget.cache 602B
BaGet.Protocol.Tests.csproj.AssemblyReference.cache 571B
BaGet.Protocol.csproj.AssemblyReference.cache 504B
BaGet.Web.Tests.assets.cache 337B
BaGet.Tests.assets.cache 329B
BaGet.Protocol.Tests.AssemblyInfoInputs.cache 42B
BaGet.Protocol.Tests.AssemblyInfoInputs.cache 42B
BaGet.Web.Tests.AssemblyInfoInputs.cache 42B
BaGet.Tests.AssemblyInfoInputs.cache 42B
BaGet.Core.Tests.AssemblyInfoInputs.cache 42B
BaGet.Core.Tests.AssemblyInfoInputs.cache 42B
BaGet.Database.SqlServer.AssemblyInfoInputs.cache 42B
BaGet.Database.SqlServer.csproj.CoreCompileInputs.cache 42B
BaGet.Database.SqlServer.AssemblyInfoInputs.cache 42B
BaGet.Database.SqlServer.csproj.CoreCompileInputs.cache 42B
BaGet.Core.AssemblyInfoInputs.cache 42B
共 4356 条
- 1
- 2
- 3
- 4
- 5
- 6
- 44
资源评论
qq_41846523
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功