Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 4 Examples of "vxe-table in functional component" in JavaScript

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'vxe-table' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

import Vue from 'vue'
import XEUtils from 'xe-utils/methods/xe-utils'
import {
  VXETable,
  Icon,
  Header,
  Body,
  Column,
  Table
} from 'vxe-table'
import zhCN from 'vxe-table/lib/locale/lang/zh-CN'

// 导入默认的国际化(如果项目中使用多语言,则应该导入到 vue-i18n 中)
VXETable.setup({
  i18n: key => XEUtils.get(zhCN, key)
})

// 按需导入依赖的模块
Vue.use(Icon)
Vue.use(Header)
Vue.use(Body)
Vue.use(Column)
// 最后安装核心库
Vue.use(Table)
import Vue from 'vue'
import XEUtils from 'xe-utils'
import {
  VXETable,
  Icon,
  Header,
  Body,
  Column,
  Table
} from 'vxe-table'
import zhCN from 'vxe-table/lib/locale/lang/zh-CN'

// 导入默认的国际化(如果项目中使用多语言,则应该导入到 vue-i18n 中)
VXETable.setup({
  i18n: key => XEUtils.get(zhCN, key)
})

// 按需导入依赖的模块
Vue.use(Icon)
Vue.use(Header)
Vue.use(Body)
Vue.use(Column)
// 最后安装核心库
Vue.use(Table)
import Vue from 'vue'
import VXETable from 'vxe-table'
import i18n from '../i18n'
import 'vxe-table/lib/index.css'

Vue.use(VXETable)

VXETable.setup({
  // 集成 vue-i18n
  i18n: key => i18n.t(key),
  // 对参数的内容自动进行国际化翻译
  translate (key) {
    // 只翻译 "app." 开头的键值
    if (key && key.indexOf('app.') > -1) {
      return i18n.t(key)
    }
    return key
  }
})
Vue.use(VXETable)

function sendAjax (options, callback, defaultCallback) {
  if (options && !XEUtils.isArray(options)) {
    const ajaxOpts = Object.assign({ method: 'GET' }, XEUtils.isString(options) ? { url: options } : options)
    XEAjax(ajaxOpts).then(response => response.json()).then(callback)
    if (defaultCallback) {
      defaultCallback()
    } else {
      callback()
    }
  }
}

// 设置默认参数
VXETable.setup({
  grid: {
    /**
     * Grid 封装统一的数据代理
     * 任何支持 Promise 的异步请求库都能对接,不同的库可能用法会不一样,基本大同小异(fetch、jquery、axios、xe-ajax)
     * 支持增删改查自动发送请求
     * 支持 filters 自动请求数据
     * 支持 edit-render 下拉框自动请求数据
     */
    proxyConfig: {
      // 列初始化之前
      beforeColumn ({ $grid, column }) {
        const { filters, editRender } = column
        // 处理筛选请求
        sendAjax(filters, data => {
          $grid.setFilter(column, data)
        }, () => {

Is your System Free of Underlying Vulnerabilities?
Find Out Now