@ag-grid-community/vue

中文文档
31.3.4发布于 2024/07/16MITTypeScriptESM + CJS零依赖近 30 天下载 1.7万

AG Grid Vue 2 Component

原始使用文档
文档目录12 节
  1. Features
  2. Getting started
  3. Install dependencies
  4. Import the AgGridVue Component
  5. Import styles in
  6. Set the grid's configuration in the parent component
  7. Render the grid
  8. Complete example:
  9. Issue Reporting
  10. Asking Questions
  11. Contributing
  12. License

AG Grid HTML5 Grid trusted by the community, built for enterprise

CDNJS npm npm

AG Grid Vue Component

AG Grid is a fully-featured and highly customizable JavaScript data grid. It delivers outstanding performance, has no third-party dependencies and integrates smoothly with Vue.

Here's how our grid looks with multiple filters and grouping enabled:

Image of AG Grid showing filtering and grouping enabled.

Features

In addition to the standard set of features you'd expect from any grid:

  • Column Interactions (resize, reorder, and pin columns)
  • Pagination
  • Sorting
  • Row Selection

Here are some of the features that make AG Grid stand out:

  • Grouping / Aggregation *
  • Accessibility support
  • Custom Filtering
  • In-place Cell Editing
  • Records Lazy Loading *
  • Server-Side Records Operations *
  • Live Stream Updates
  • Hierarchical Data Support & Tree View *
  • Customizable Appearance
  • Customizable Cell Contents
  • State Persistence
  • Keyboard Navigation
  • Data Export to CSV
  • Data Export to Excel *
  • Excel-like Pivoting *
  • Row Reordering
  • Copy / Paste
  • Column Spanning
  • Pinned Rows
  • Full Width Rows
  • Integrated Charting
  • Sparklines

* The features marked with an asterisk are available in the Enterprise version only.

Check out the developer documentation for a complete list of features or visit our official docs for tutorials and feature demos.

Getting started

Use the setup instructions below or go through a 5-minute-quickstart guide.

Install dependencies

$ npm install --save @ag-grid-community/core @ag-grid-community/vue

Import the AgGridVue Component

import { AgGridVue } from "@ag-grid-community/vue";

Import styles in

import "@ag-grid-community/styles/ag-grid.css";
import "@ag-grid-community/styles/ag-theme-quartz.css";

Set the grid's configuration in the parent component

export default {
  name: "App",
  components: {
    AgGridVue,
  },
  setup() {
    return {
      columnDefs: [
        { headerName: "Make", field: "make" },
        { headerName: "Model", field: "model" },
        { headerName: "Price", field: "price" },
      ],
      rowData: [
        { make: "Toyota", model: "Celica", price: 35000 },
        { make: "Ford", model: "Mondeo", price: 32000 },
        { make: "Porsche", model: "Boxster", price: 72000 },
      ],
    };
  },
};

Render the grid

  <ag-grid-vue
    style="width: 500px; height: 200px"
    class="ag-theme-quartz"
    :columnDefs="columnDefs"
    :rowData="rowData">
  </ag-grid-vue>

Complete example:

<template>
  <ag-grid-vue
    style="width: 500px; height: 200px"
    class="ag-theme-quartz"
    :columnDefs="columnDefs"
    :rowData="rowData"
  >
  </ag-grid-vue>
</template>

<script>
import "@ag-grid-community/styles/ag-grid.css";
import "@ag-grid-community/styles/ag-theme-quartz.css";
import { AgGridVue } from "@ag-grid-community/vue";

export default {
  name: "App",
  components: {
    AgGridVue,
  },
  setup() {
    return {
      columnDefs: [
        { headerName: "Make", field: "make" },
        { headerName: "Model", field: "model" },
        { headerName: "Price", field: "price" },
      ],
      rowData: [
        { make: "Toyota", model: "Celica", price: 35000 },
        { make: "Ford", model: "Mondeo", price: 32000 },
        { make: "Porsche", model: "Boxster", price: 72000 },
      ],
    };
  },
};
</script>

Issue Reporting

If you have found a bug, please report it in this repository's issues section. If you're using the Enterprise version, please use the private ticketing system to do that.

Asking Questions

Look for similar problems on StackOverflow using the ag-grid tag. If nothing seems related, post a new message there. Please do not use GitHub issues to ask questions.

Contributing

AG Grid is developed by a team of co-located developers in London. If you want to join the team send your application to [email protected].

License

This project is licensed under the MIT license. See the LICENSE file for more info.

版本与发布记录

@ag-grid-community/vue 共发布 62 个版本,首次发布于 2019/11/05;过去 12 个月发布了 0 个版本。

版本发布日期距今
31.3.4latest2024/07/162 年前
31.3.32024/07/162 年前
31.3.22024/05/152 年前
31.3.12024/04/302 年前
31.3.02024/04/302 年前
31.2.12024/04/102 年前

其他发布通道:beta → 22.0.0-beta.1。

关于 @ag-grid-community/vue 的常见问题

@ag-grid-community/vue 是什么?

AG Grid Vue 2 Component

如何安装 @ag-grid-community/vue?

在项目目录运行 npm install @ag-grid-community/vue,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@ag-grid-community/core(31.3.4)、vue(>= 2.2 <= 2.5.17 || >= 2.5.20)、vue-property-decorator(^7.2.0 || ^8.0.0 || ^9.1.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ag-grid-community/vue 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ag-grid-community/vue 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@ag-grid-community/vue 可以商用吗?

@ag-grid-community/vue 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ag-grid-community/vue 的下载量有多少?

根据 npm 官方下载统计,@ag-grid-community/vue 在 2026/10/05 – 2026/11/03 这 30 天内被下载 16,751 次,日均约 558 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ag-grid-community/vue 还在维护吗?

最新版本 31.3.4 发布于 2024/07/16(2 年前);至今共发布 62 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/11/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。