New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

auto-vue-manual

Package Overview
Dependencies
Maintainers
2
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

auto-vue-manual

```bash npm install auto-vue-manual ```

latest
npmnpm
Version
0.2.98
Version published
Maintainers
2
Created
Source

自用组件库

安装

npm install auto-vue-manual

使用

import AutoVueManual from "auto-vue-manual";
import type { InstallOptions } from 'auto-vue-manual';
import 'auto-vue-manual/dist/index.css';

import request from "@/global/request";
import { Translate } from "@/languages/index";

const options: InstallOptions = {
  request,
  translate: Translate
}

const app = createApp(App);
app.use(AutoVueManual, options);
app.mount('#app');

目录

Table

ProTable/ProTableSummary
ProTableList

Modal

BasicDialog
BasicDrawer
FormDialog
TableDialog

Upload

UploadAvatar
UploadImage
UploadImages

Button

组件列表

  • OpenButton 新建按钮
  • RefreshButton 刷新按钮
  • SearchButton 搜索按钮
  • ResetButton 重置按钮

通用 Props

属性名类型说明默认值
typestring按钮类型'primary'(Open/Search),'default'(Refresh),'warning'(Reset)
sizestring按钮尺寸'default'
showIconboolean是否显示图标true
circleboolean是否圆形按钮true
plainboolean是否朴素按钮false
disabledboolean是否禁用false
loadingboolean是否加载中false
tstring按钮文本''

OpenButton

  • 用于新建操作,蓝色圆形加号图标。
  • 事件:@open 点击触发

RefreshButton

  • 用于刷新操作,圆形刷新图标。
  • 事件:@refresh 点击触发
  • 支持 loading 状态自定义

SearchButton

  • 用于搜索操作,蓝色圆形放大镜图标。
  • 事件:@search 点击触发

ResetButton

  • 用于重置操作,橙色圆形刷新图标。
  • 事件:@reset 点击触发

示例代码

<template>
  <OpenButton @open="onOpen" />
  <RefreshButton :loading="loading" @refresh="onRefresh" />
  <SearchButton t="搜索" @search="onSearch" />
  <ResetButton t="重置" @reset="onReset" />
</template>
<script setup lang="ts">
  import { ref } from 'vue'
  import { OpenButton, RefreshButton, SearchButton, ResetButton } from 'auto-vue-manual'
  const loading = ref(false)
  const onOpen = () => {
    /* 新建逻辑 */
  }
  const onRefresh = () => {
    loading.value = true
    setTimeout(() => (loading.value = false), 1000)
  }
  const onSearch = () => {
    /* 搜索逻辑 */
  }
  const onReset = () => {
    /* 重置逻辑 */
  }
</script>

Document

Table

ProTable / ProTableSummary

ColumnProps

属性名类型说明默认值
typestring列类型, index / selection/ radio/ expand/ sort/ icon/ tag/ copy-
propstring列数据字段名-
labelstring列标题-
widthnumber列宽-
alignstring列对齐方式center
isShowboolean是否显示在表格当中true
search{ defaultValue }搜索项配置, defaultValue可以设置默认的init-param-
headerRender(scope: HeaderRenderScope<T>) => VNode自定义表头内容渲染(tsx语法)-
render(scope: RenderScope<T>) => VNode string自定义单元格内容渲染(tsx语法),Basic和list的scope略有不同,请注意-
props{ api?: string, activeValue?: any, inactiveValue?: any, refresh?: boolean }type = switch 时,props 配置 (TODO 更新其他type)-

Props 参数说明

属性名类型说明默认值
columnsColumnProps[]必填,列配置项-
dataany[]静态 table data 数据,若存在则不会使用 request url 返回的 data-
urlstring实际请求接口-
auto-searchboolean是否自动执行请求 apitrue
request-error(params: any) => void表格 api 请求错误监听-
data-callback(data: any) => any返回数据的回调函数,可以对数据进行处理-
has-paginationboolean是否需要分页组件true
init-paramany初始化请求参数{}
search-paramany搜索参数{}
borderboolean是否带有纵向边框true
row-keystring行数据的 Key,用来优化 Table 的渲染,当表格数据多选时,所指定的 id )id
sizestring列表大小,default/small/largesmall
page-sizenumber列表页大小0
row-hnumber列表行高0
ext-hnumber列表额外高度0
sum-urlstring汇总接口url,仅 ProTableSummary 有效
sum-textstring汇总文本,仅 ProTableSummary 有效Total
sum-text-formatstring汇总文本格式,仅 ProTableSummary 有效*

Event 事件说明

事件名说明参数
@row-click行点击事件,已排除 status / operation 列(row: any, column: any) => void
@row-dblclick行双击事件,已排除 status / operation 列(row: any, column: any) => void
@switch-change开关切换事件(value, scope, column) => void

Expose 暴露方法说明

方法名说明参数
@search搜索事件(searchParam?: Record<string, any>) => void
@reset重置事件() => void
@getTableList获取表格数据,不更新搜索参数及分页参数() => void

示例代码

<template>
  <div>
    <el-button @click="search">搜索</el-button>
    <el-button @click="reset">重置</el-button>
  </div>
  <ProTable ref="proTableRef" :columns="columns" url="/league/search" :search-param="params" @row-dblclick="onRowDblclick">
    <template #logo="{ row }">
      <div class="flex-center h-100">
        <el-image style="width: 36px; height: 36px" :src="row.logo" />
      </div>
    </template>
  </ProTable>
</template>
<script setup lang="ts">
  import type { ColumnProps, RenderScope, HeaderRenderScope } from 'auto-vue-manual'

  import { reactive, ref } from 'vue'
  import { ProTable } from 'auto-vue-manual'

  const proTableRef = ref<InstanceType<typeof ProTable>>()
  const columns: ColumnProps[] = [
    { label: 'index', type: 'index' },
    { prop: 'code', label: '代号', width: 100, type: 'tag' },
    { prop: 'logo', label: '标志', width: 100 },
    {
      prop: 'status',
      label: '状态',
      width: 100,
      type: 'switch',
      props: {
        activeValue: 1,
        inactiveValue: 2,
        api: '/league/change_status',
        refresh: true
      }
    },
    {
      prop: 'name',
      label: '名称',
      width: 0,
      align: 'right',
      search: { defaultValue: 'League' },
      headerRender: ({ column }: HeaderRenderScope<any>) => {
        return <span>headerRender: {column.label}</span>
      },
      render: ({ row }: RenderScope<any>) => {
        return <span>render: {row.name}</span>
      }
    }
  ]
  const params = reactive({
    keyword: ''
  })
  const search = () => {
    // 修改搜索参数
    params.keyword = 'League'
    proTableRef.value?.search()
    // 直接传入参数
    // proTableRef.value?.search({
    //   keyword: "League",
    // })
  }
  const reset = () => {
    proTableRef.value?.reset()
  }
  const onRowDblclick = (row: any, column: any, event: any) => {
    console.log('onRowDblclick', row, column, event)
  }
</script>

ProTableList

Props 参数说明

属性名类型说明默认值
row-keystring行数据的 Key,用来优化 Table 的渲染,当表格数据多选时,所指定的 id )id

其余同 ProTable

Event 事件说明

事件名说明参数
@row-click行点击事件,未排除 status / operation 列,需添加 e.stopPropagation() 阻止事件冒泡({ row: any, column: any }) => void
@row-dblclick行双击事件,未排除 status / operation 列,需添加 e.stopPropagation() 阻止事件冒泡({ row: any, column: any }) => void

Expose 暴露方法说明

与 ProTable 相同。

示例代码

<template>
  <div>
    <el-button @click="search">搜索</el-button>
    <el-button @click="reset">重置</el-button>
  </div>
  <ProTableList ref="proTableRef" row-key="key" :columns="columns" :search-param="params" url="/page/list" @row-dblclick="onRowDblclick" />
</template>
<script setup lang="tsx">
  import type { RowEventHandlerParams } from 'element-plus'
  import type { ColumnProps, HeaderRenderScope, RenderScope } from 'auto-vue-manual'

  import { ref, reactive } from 'vue'

  import { Plus } from '@element-plus/icons-vue'
  import ProTableList from 'auto-vue-manual'

  const proTableRef = ref<InstanceType<typeof ProTableList>>()
  const columns: ColumnProps[] = [
    { label: 'index', type: 'index' },
    { prop: 'label', label: 'Label', width: 100, type: 'tag' },
    { prop: 'key', label: 'Key', width: 100, type: 'copy' },
    {
      prop: 'value',
      label: 'Value',
      width: 200,
      headerRender: (scope: HeaderRenderScope<any>) => {
        return <span>HeaderRender: {scope.column.label}</span>
      }
    },
    {
      prop: 'status',
      label: 'Status',
      width: 100,
      type: 'switch',
      props: {
        activeValue: 1,
        inactiveValue: 2,
        api: '/league/change_status',
        refresh: true
      }
    },
    {
      prop: 'action',
      label: 'Action',
      width: 60,
      align: 'center',
      render: (scope: RenderScope<any>) => {
        return (
          <el-button
            type="primary"
            size="small"
            link
            icon={Plus}
            onClick={(e: Event) => {
              e.stopPropagation()
              console.log('onclick', e)
            }}
          >
            <span>render: {scope.rowData.label}</span>
          </el-button>
        )
      }
    }
  ]
  const params = reactive({
    keyword: ''
  })
  const search = () => {
    // 修改搜索参数
    params.keyword = 'League'
    proTableRef.value?.search()
    // 直接传入参数
    // proTableRef.value?.search({
    //   keyword: "League",
    // })
  }
  const reset = () => {
    proTableRef.value?.reset()
  }
  const onRowDblclick = (row: RowEventHandlerParams) => {
    console.log('onRowDblclick', row)
  }
</script>

Modal 弹窗/抽屉

统一说明

  • 所有弹窗类组件(BasicDialog、FormDialog、TableDialog)均基于 BasicDialog 实现,props/事件/用法风格统一。
  • 所有抽屉类组件均基于 BasicDrawer 实现。
  • 支持 v-bind 透传 Element Plus Dialog/Drawer 的所有原生属性。

通用 Props

属性名类型说明默认值
visibleboolean是否显示false
showCloseboolean是否显示关闭按钮true
titlestring标题Title
widthstring宽度520px
topstring顶部距离15vh
dialogPropsobject透传 Dialog/Drawer 属性{}
appendToBodyboolean是否插入 bodytrue
lockScrollboolean是否锁定滚动true
closeOnClickModalboolean点击遮罩关闭false

BasicDialog

  • 通用弹窗基类,支持所有通用 props 和事件。
  • 事件:@update:visible@closed@submit

BasicDrawer

  • 通用抽屉基类,支持所有通用 props 和事件。
  • 事件:@update:visible@closed

FormDialog

  • 基于 BasicDialog 扩展,内置底部按钮,适合表单场景。
  • 额外 props:executing(是否执行中)、footer(是否显示底部)、btnSizeokTextcancelText
  • 事件:@submit@closed@before-close

TableDialog

  • 基于 BasicDialog 扩展,适合表格弹窗场景。
  • 额外 props:requesting(是否请求中)

示例代码

<template>
  <OpenButton @open="visible = true" />
  <BasicDialog :visible="visible" title="标题" width="520px" @update:visible="visible = $event" @closed="onClosed">
    <template #default>内容区域</template>
  </BasicDialog>
</template>
<script setup lang="ts">
  import { ref } from 'vue'
  import { BasicDialog, OpenButton } from 'auto-vue-manual'
  const visible = ref(false)
  const onClosed = () => {
    visible.value = false
  }
</script>

FormDialog 示例

<template>
  <OpenButton @open="visible = true" />
  <FormDialog :visible="visible" title="表单弹窗" @update:visible="visible = $event" @submit="onSubmit">
    <template #default>
      <el-input v-model="form.name" placeholder="请输入名称" />
    </template>
  </FormDialog>
</template>
<script setup lang="ts">
  import { ref } from 'vue'
  import { FormDialog, OpenButton } from 'auto-vue-manual'
  const visible = ref(false)
  const form = ref({ name: '' })
  const onSubmit = () => {
    /* 提交逻辑 */
  }
</script>

Upload

UploadAvatar

Props 参数说明

属性名类型说明默认值
urlstring上传地址-
avatarstring头像地址-
textstring上传提示-
pathstring保存路径-
previewboolean是否显示预览false
disabledboolean是否禁用false
sizenumber大小(KB)5120

UploadImage

Props 参数说明

属性名类型说明默认值
imagestring图片地址-

其余同 UploadAvatar

示例代码

<template>
  <UploadAvatar ref="uploadAvatarRef" url="/upload/image" :avatar="avatar" text="上传头像" path="/avatar" preview :size="1024" />
</template>
<script setup lang="ts">
  import { ref } from 'vue'
  import UploadAvatar from 'auto-vue-manual'

  const uploadAvatarRef = ref<InstanceType<typeof UploadAvatar>>()
  const avatar = ref('')
</script>

UploadImages

Props 参数说明

属性名类型说明默认值
imagesFileList[]图片地址-
limitnumber限制数量10

其余同 UploadAvatar

示例代码

<template>
  <UploadImages ref="uploadImagesRef" url="/upload/image" :images="images" text="上传图片" path="/image" preview :size="1024" />
</template>
<script setup lang="ts">
  import type { FileList } from 'auto-vue-manual'

  import { ref } from 'vue'
  import UploadImages from 'auto-vue-manual'

  const uploadImagesRef = ref<InstanceType<typeof UploadImages>>()
  const images = ref<FileList[]>([])
</script>

Tinymce 富文本编辑器

组件说明

基于 tinymce 封装的富文本编辑器,支持图片上传、字数统计、代码高亮等常用功能,适用于内容管理、文章编辑等场景。

Props 参数说明

属性名类型说明默认值
urlstring图片上传接口/upload/image
contentstring编辑器内容(v-model)''
heightnumber编辑器高度600
disabledboolean是否禁用编辑false

事件

事件名说明参数
update:content内容变更时触发value: string

功能特性

  • 支持图片粘贴/上传,自动调用 url 接口
  • 支持字数统计、代码高亮、列表、字体样式等
  • 支持自定义高度、禁用状态
  • 默认中文界面

示例代码

<template>
  <Tinymce v-model:content="content" :height="400" :url="'/upload/image'" />
  <p>内容:{{ content }}</p>
</template>
<script setup lang="ts">
  import { ref } from 'vue'
  import Tinymce from 'auto-vue-manual'
  const content = ref('<p>初始内容</p>')
</script>

FAQs

Package last updated on 27 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts