### Avue Quick Start Guide
Source: https://github.com/yuchenhui/avue2/blob/main/README.md
Covers the initial steps for using the Avue framework, including installation procedures and basic usage guidelines. This section is essential for new users to get started with the framework.
```zh
- [介绍](home.md) - Avue 框架介绍
- [快速上手](installation.md) - 安装和基本使用
- [全局配置](global.md) - 全局配置选项
- [全局api](api.md) - 全局 API 函数
- [国际化](locale.md) - 多语言切换设置
```
--------------------------------
### Avue Installation Guide
Source: https://github.com/yuchenhui/avue2/blob/main/home.md
Provides instructions on how to install and get started with Avue, a low-code frontend framework.
```Markdown
Please refer to the [Quick Start](https://v2.avuejs.com/docs/installation.html) chapter.
```
--------------------------------
### Install Avue with Vue CLI
Source: https://github.com/yuchenhui/avue2/blob/main/installation.md
Create a new project using Vue CLI and install Avue through its dependency management interface.
```bash
# Install Vue Cli
npm install -g @vue/cli
# Create a project
vue create hello-world
# After creation, open the graphical interface via the command, as shown below
vue ui
# In the graphical interface, click Dependencies -> Install Dependencies, then add @smallwei/avue to the dependencies.
```
--------------------------------
### Install Avue via CDN
Source: https://github.com/yuchenhui/avue2/blob/main/installation.md
Include Avue using CDN links in an HTML file. Access components via the global AVUE variable. Requires Vue and ElementUI.
```html
```
--------------------------------
### Install Avue with npm/yarn
Source: https://github.com/yuchenhui/avue2/blob/main/installation.md
Install Avue using npm or yarn in an existing Vue project. ElementUI is a required dependency.
```js
//Install ElementUI dependency first
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import Avue from '@smallwei/avue';
import '@smallwei/avue/lib/index.css';
Vue.use(ElementUI)
Vue.use(Avue);
```
--------------------------------
### Avue with Axios for Dictionary Usage
Source: https://github.com/yuchenhui/avue2/blob/main/installation.md
Configure Avue to use Axios for dictionary data fetching. For older versions, set window.axios.
```js
import axios from 'axios'
Vue.use(Avue,{axios})
// For older versions:
// main.js
// window.axios = axios
```
--------------------------------
### Avue Setup with Axios
Source: https://github.com/yuchenhui/avue2/blob/main/crud/dic.md
Demonstrates how to integrate Axios with Avue for data fetching. This setup is crucial for network dictionary configurations. Ensure Axios is installed and imported.
```js
import axios from 'axios'
Vue.use(Avue,{axios})
// For older versions:
// window.axios = axios
```
--------------------------------
### Avue DialogForm Usage Examples
Source: https://github.com/yuchenhui/avue2/blob/main/default/dialog-form.md
Demonstrates how to trigger modal and drawer forms using the $DialogForm service. Includes examples for showing a basic modal form, a drawer form, and a modal form pre-populated with data.
```javascript
export default {
data() {
return {
option: {
submitText: '完成',
span:24,
column: [
{
label: "姓名",
prop: "name",
rules: [{
required: true,
message: "请输入姓名",
trigger: "blur"
}],
},
{
label: "年龄",
prop: "age"
}
]
},
form: {}
}
},
methods: {
showDialog(type) {
this.$DialogForm.show({
title: '弹窗页面',
width: '30%',
type:type,
menuPosition:'right',
option: this.option,
beforeClose: (done) => {
this.$message.success('关闭前方法')
done()
},
callback:(res)=>{
console.log(res.data);
this.$message.success('关闭等待框')
setTimeout(() => {
res.done()
setTimeout(() => {
this.$message.success('关闭弹窗')
res.close()
}, 1000)
}, 1000)
}
})
},
showDialog1() {
this.$DialogForm.show({
title: '弹窗页面(带上数据)',
width: '50%',
data: { name: 'small',age:18 },
option: this.option,
callback:(res)=>{
console.log(res.data);
this.$message.success('关闭等待框')
setTimeout(() => {
res.done()
setTimeout(() => {
this.$message.success('关闭弹窗')
res.close()
}, 1000)
}, 1000)
}
})
}
}
}
}
```
```html
弹窗表单 抽屉表单 弹窗表单(带上数据)
```
--------------------------------
### Basic Pagination Setup
Source: https://github.com/yuchenhui/avue2/blob/main/crud/page.md
Demonstrates the fundamental setup of pagination in Avue2. It shows how to bind page properties like `currentPage`, `pageSize`, and `total` to the `avue-crud` component and control them via buttons.
```vue
页码:{{page.currentPage}}
页码+1
条数:{{page.pageSize}}
条数+10
总数:{{page.total}}
总页数+10
```
--------------------------------
### Avue File Upload Setup
Source: https://github.com/yuchenhui/avue2/blob/main/form/form-upload.md
Demonstrates how to import and use the Avue upload component with Axios. This setup is necessary for making HTTP requests for file uploads.
```js
//使用上传附件需要引入axios
import axios from "axios";
Vue.use(Avue, { axios });
```
--------------------------------
### Avue Login Component Examples
Source: https://github.com/yuchenhui/avue2/blob/main/default/login.md
Demonstrates the usage of the Avue Login component with different configurations for various login scenarios. Includes examples for standard user login, image verification code login, phone number login, and customization of fields and margins.
```html
普通用户登录
图片验证码登录
手机号登录
改变字段
调整边距
```
--------------------------------
### Avue Form Configuration Example
Source: https://github.com/yuchenhui/avue2/blob/main/crud/default.md
Shows a configuration object for an Avue form, defining fields like file upload and array input. It includes properties for data types, input types, HTTP configurations for uploads, and display tips.
```javascript
{
dataType: 'string',
type: 'upload',
propsHttp: {
home:'https://avuejs.com',
res: 'data'
},
span: 24,
listType: 'picture-card',
tip: '只能上传jpg/png文件,且不超过500kb',
action: '/imgupload'
}, {
label: '数组',
prop: 'array',
dataType: 'number',
propsHttp: {
home:'http://demo.cssmoban.com',
},
type: 'array'
}
```
--------------------------------
### Icon Examples
Source: https://github.com/yuchenhui/avue2/blob/main/component/input-icon.md
Demonstrates various icon categories available in Avue, including parking, basic, directional, and symbol icons. Each icon is represented by a string value.
```javascript
{
icon: {
list: [
{
label: '停车场',
value: '#icon-tingchechang'
}
]
},
basicIcons: {
label: '基本图标',
list: ['el-icon-info', 'el-icon-error', 'el-icon-error', 'el-icon-success', 'el-icon-warning', 'el-icon-question']
},
directionIcons: {
label: '方向图标',
list: ['el-icon-info', 'el-icon-back', 'el-icon-arrow-left', 'el-icon-arrow-down', 'el-icon-arrow-right', 'el-icon-arrow-up']
},
symbolIcons: {
label: '符号图标',
list: ['el-icon-plus', 'el-icon-minus', 'el-icon-close', 'el-icon-check']
}
}
```
--------------------------------
### Avue CRUD Component Usage Example
Source: https://github.com/yuchenhui/avue2/blob/main/crud/crud-fun.md
This example demonstrates how to use the Avue CRUD component with the custom mixin. It shows the template structure, binding the mixin's data and events, and configuring the component via an options file and API definitions.
```js
@/page/system/params.vue
```
--------------------------------
### Avue Skeleton Examples
Source: https://github.com/yuchenhui/avue2/blob/main/default/skeleton.md
Demonstrates various Avue Skeleton component configurations including basic placeholder, block mode, avatar display, custom rows, custom list items, and dynamic loading with a switch.
```html
最简单的占位效果。
最后一行占满的效果
带头像的效果
自定义行数的效果
自定义列表的效果
动态切换效果
加载的内容
```
```javascript
export default {
data(){
return {
loading:true,
}
}
}
```
--------------------------------
### Avue Framework Introduction
Source: https://github.com/yuchenhui/avue2/blob/main/README.md
Provides an introduction to the Avue framework, detailing its purpose as a low-code front-end framework based on the Element framework. It highlights how JSON configuration is used to generate pages, reducing development effort and significantly improving efficiency.
```zh
Avue 是一个基于 Element 框架的低代码前端框架,使用 JSON 配置来生成页面,可以减少页面开发工作量,极大提升效率。
```
--------------------------------
### Basic Color Picker Usage
Source: https://github.com/yuchenhui/avue2/blob/main/form/input-color.md
Demonstrates the basic setup for a color picker input in an Avue form. It requires defining the 'color' type for the input column.
```vue
```
--------------------------------
### Qiniu Cloud OSS Upload Setup
Source: https://github.com/yuchenhui/avue2/blob/main/form/form-upload.md
Instructions for setting up Qiniu Cloud OSS uploads in Avue. This includes importing the CryptoJS library and configuring Vue.use with Qiniu credentials and bucket information.
```html
```
```js
Vue.use(AVUE, {
qiniu: {
AK: '', //七牛云相关密钥
SK: '', //七牛云相关密钥
bucket:'https://upload.qiniup.com', //存储地区,默认为华东,其他的如下表
scope: 'test', //存储空间名称
url: 'https://cdn.avuejs.com/' //外链的域名地址
}
})
```
```vue
```
--------------------------------
### Avue Code Component Usage
Source: https://github.com/yuchenhui/avue2/blob/main/default/code.md
Example of using the Avue code component in a Vue template. The `syntax` prop specifies the language for highlighting, and the `height` prop controls the component's height. This component is typically used within a Vue application after installing Avue.
```vue
// Used in main.js
Vue.use(AVUE);
```
--------------------------------
### Avue Crud Object Column Configuration
Source: https://github.com/yuchenhui/avue2/blob/main/crud/object.md
Demonstrates how to configure the 'column' property of the Avue Crud component as an object, where each key corresponds to a 'prop'. This feature was added in version 2.10.12. The example shows a basic setup with 'name' and 'sex' columns.
```vue
```
--------------------------------
### Avue Data Filtering Example
Source: https://github.com/yuchenhui/avue2/blob/main/crud/form.md
Illustrates how to filter data dictionaries and null fields in Avue forms. It provides buttons to trigger filtering actions and displays the form data. The `filterDic` option removes fields starting with '$', and `filterNull` removes fields with empty values.
```vue
过滤数据字典过滤空数据不过滤
{{form}}
```
--------------------------------
### HTML Setup for Highlight.js
Source: https://github.com/yuchenhui/avue2/blob/main/default/code.md
This snippet shows how to include the necessary highlight.js CSS and JavaScript files in your HTML's head section to enable code highlighting. Ensure these are loaded before your application's scripts.
```html
```
--------------------------------
### Color Picker with Default Value
Source: https://github.com/yuchenhui/avue2/blob/main/form/input-color.md
Shows how to set an initial default value for the color picker using the 'value' property. The example sets a default RGBA color.
```vue
```
--------------------------------
### Global Avue Configuration
Source: https://github.com/yuchenhui/avue2/blob/main/global.md
Demonstrates how to initialize Avue with global configuration options. This includes setting component sizes, default CRUD and Form options, and cloud storage configurations.
```javascript
Vue.use(AVUE,{
size:'',
crudOption:{},
formOption:{},
tableSize:'',
formSize:'',
appendToBody:true,
modalAppendToBody:true,
cos:{},
qiniu:{},
ali:{},
canvas:{}
});
```
--------------------------------
### Avue Crud with Custom Menu Left Slot
Source: https://github.com/yuchenhui/avue2/blob/main/crud/head.md
This example demonstrates how to add custom content to the left side of the Avue Crud menu bar using the `menuLeft` slot. A primary button is added as an example.
```vue
自定义按钮
```
--------------------------------
### Default Time for Datetime Range
Source: https://github.com/yuchenhui/avue2/blob/main/form/form-date.md
Sets default start and end times for the 'datetimerange' picker. The 'defaultTime' property accepts an array of strings, where the first element sets the start time and the second sets the end time.
```vue
```
--------------------------------
### Image Cropper Usage Example
Source: https://github.com/yuchenhui/avue2/blob/main/default/image-cropper.md
Demonstrates how to integrate and use the Image Cropper component within a Vue application. It includes opening the cropper, displaying cropped images, and handling callbacks for success and cancellation.
```vue
打开图片裁剪
裁剪图片
```
--------------------------------
### Avue Dynamic Subform - Form Usage
Source: https://github.com/yuchenhui/avue2/blob/main/form/form-dynamic.md
Illustrates using the dynamic subform component in a form-centric manner by setting the `type` to 'form' within the `children` configuration. This example also shows how to hide the row index by setting `index` to `false`.
```vue
序号:{{row.$index}}-数据:{{row.input}}
```
--------------------------------
### Avue input-table Single Selection Example
Source: https://github.com/yuchenhui/avue2/blob/main/component/input-table.md
Demonstrates the basic usage of the Avue input-table component for single data selection. It includes configuration for columns, props, and a data loading function.
```vue
值:{{form}}
格式化值:{{form}}
```
--------------------------------
### Avue Version Information
Source: https://github.com/yuchenhui/avue2/blob/main/home.md
Clarifies the documentation version and provides a link to the Vue 3.x upgrade.
```Markdown
You are browsing the Avue documentation based on Vue 2.x; [click here](https://avuejs.com/) to view the upgraded version for Vue 3.x.
```
--------------------------------
### Alibaba Cloud OSS Integration
Source: https://github.com/yuchenhui/avue2/blob/main/form/form-upload.md
Provides instructions for integrating Alibaba Cloud OSS for file uploads with Avue Form. This involves including the Alibaba Cloud SDK and configuring global Avue parameters with OSS credentials.
```html
```
```javascript
//入口处全局配置阿里云的参数
Vue.use(AVUE, {
ali: {
region: "oss-cn-beijing",
endpoint: "oss-cn-beijing.aliyuncs.com",
stsToken: "",
accessKeyId: "",
accessKeySecret: "",
bucket: "avue",
},
});
```
--------------------------------
### Avue Form Grouping Example
Source: https://github.com/yuchenhui/avue2/blob/main/crud/form.md
Demonstrates how to group form elements in Avue using the 'group' property in the option. This example includes sections for user information, refund applications with cascaded selects for province, city, and area, and custom user information fields.
```vue
```
--------------------------------
### Avue Notice Component Script Logic
Source: https://github.com/yuchenhui/avue2/blob/main/default/notice.md
Provides the JavaScript logic for the Avue Notice component example. It defines the component's data, including the notice list and configuration options, and implements methods for handling user interactions and data pagination.
```javascript
let list = [
{
img: 'https://avuejs.com/images/logo-bg.jpg',
title: '史蒂夫·乔布斯 关注了你',
subtitle: '05-08 15:08',
tag: '已经开始',
status: 0
},
{
img: 'https://avuejs.com/images/logo-bg.jpg',
title: '斯蒂夫·沃兹尼亚克 关注了你',
subtitle: '05-08 15:08',
tag: '未开始',
status: 1
},
{
img: 'https://avuejs.com/images/logo-bg.jpg',
title: '乔纳森·伊夫 关注了你',
subtitle: '05-08 15:08',
tag: '有警告',
status: 2
},
{
img: 'https://avuejs.com/images/logo-bg.jpg',
title: '蒂姆·库克 关注了你',
subtitle: '05-08 15:08',
status: 3,
tag: '有错误'
},
{
img: 'https://avuejs.com/images/logo-bg.jpg',
title: '比尔·费尔南德斯 关注了你',
subtitle: '05-08 15:08',
status: 4,
tag: '已完成'
}
]
export default {
data() {
return {
activeName: 'first',
option: {
props: {
img: 'img',
title: 'title',
subtitle: 'subtitle',
tag: 'tag',
status: 'status'
},
},
data: list,
}
},
methods: {
handleClick(item) {
this.$message.success(JSON.stringify(item))
},
pageChange(page, done) {
setTimeout(() => {
this.$message.success('页码' + page)
this.data = this.data.concat(list);
done();
}, 1000)
},
}
}
```
--------------------------------
### Avue Upload Component with Picture-Img List Type
Source: https://github.com/yuchenhui/avue2/blob/main/component/upload.md
This snippet demonstrates using the Avue Upload component with the `list-type` attribute set to 'picture-img'. This configuration is suitable for displaying uploaded images in a thumbnail format. It includes the same action and HTTP props configuration as the basic example.
```html
值:{{form1}}
```
```javascript
export default {
data() {
return {
action: "https://api.avuejs.com/imgupload",
propsHttp: {
url: "url",
name: "name",
res: "data",
},
form1: "",
};
},
};
```
--------------------------------
### Avue CRUD Basic Structure
Source: https://github.com/yuchenhui/avue2/blob/main/crud/menu.md
Demonstrates the basic structure of an Avue CRUD component with data and options, including column definitions. This serves as a foundational example for Avue table configurations.
```vue
```