1.4.0 • Published 3 years ago

kui-next v1.4.0

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

kui-next

最新的已迁移@kvuse/components,详情

vue3组件库

基于element-ui二次开发,根据项目需求,方便项目开发使用

安装

# Npm  
npm install kui-next
 
# Yarn  
yarn add kui-next 

使用 按需引入

import {
  KButton,
  KInput,
  KTable,
  KPage,
  KBatchTable,
  KDialog,
  KBreadcrumb,
  KTabs,
  KPicker,
} from 'kui-next';

export default {
  components: {
    KButton,
    KInput,
    KTable,
    KPage,
    KBatchTable,
    KDialog,
    KBreadcrumb,
    KTabs,
    KPicker,
  },
};

全局components

import { createApp } from 'vue';
import { KUI } from 'kui-next';
import 'kui-next/lib/style.css';
 
Vue.use(KUI)

使用

KButton

点击之后延时800ms,防止重复点击

  <k-button type="primary">
    测试按钮
  </k-button>

KInput

默认只能输入数字,默认小数点后两位

props

属性类型默认使用说明
typeStringnumberinteger 只能输入整数
pointNumber2小数点后几位
<template>
  <k-input v-model="value" placeholder="输入内容" />
</template>

<script setup>
import { ref } from 'vue';

const value = ref('');

</script>

KTable

<template>
  <k-table :table-column="tableColumn" :table-data="tableData">
    <template #set="{ row }">
      <k-button type="primary" plain @click="clickHandle(row)">
        详情
      </k-button>
    </template>
  </k-table>
</template>

<script setup>
import { ref } from 'vue';

// 如果不是动态可以不使用ref
const tableColumn = ref([
  { label: '日期', prop: 'date' },
  { label: '姓名', prop: 'name' },
  { label: '操作', custom: 'set', width: 150 },
]);

const tableData = ref([
  { date: '2022-05-20', name: '张三' },
  { date: '2022-05-21', name: '李四' },
]);

const clickHandle = (row) => {
  console.log('row: ', row);
};

</script>

<style>
</style>

props

属性类型使用说明
tableColumnArray{ lable:'日期', prop: 'date'}
tableDataArray:tableData 或者 v-model:tableData="data"
currentPageNumberv-model="current"
totalNumber数据的总条数
sizeNumber每页显示的条数

其他参数看element官网

tableColumn参数说明

Props说明类型
custom自定义内容插槽string
header自定义表头插槽string
width对应列的宽度string
minWidth对应列的最小宽度string
sortable对应列是否可以排序boolean
fixed列是否固定在左侧left或者右侧right, true 表示固定在左侧string / boolean

event

事件说明回调参数
current-change当用户切换分页的触发该事件currengPage
sort-change点击排序触发{ prop, order, currentPage, column }

kPage

<template>
  <k-page v-model="currentPage" :total="100" @current-change="currentChange" />
</template>

<script setup>
import { ref } from 'vue';

const currentPage = ref(1);

const currentChange = (value) => {
  console.log('当前页数: ', value);
};

</script>

<style>
</style>

props

属性类型使用说明
currentPageNumberv-model="current"
totalNumber数据的总条数
sizeNumberv-model:page="current" 每页显示的条数
showSizeBoolean是否显示切换每页的条数

event

事件说明回调参数
current-change当用户切换分页的触发该事件currengPage
size-change切换条数触发改事件size

KBatchTable

<template>
  <k-batch-table :table-column="tableColumn" :table-data="tableData" key-id="id" v-model="multipleSelection">
    <template #set="{ row }">
      <k-button type="primary" plain @click="clickHandle(row)">
        详情
      </k-button>
    </template>
  </k-batch-table>
</template>

<script setup>
import { ref } from 'vue';

// 如果不是动态可以不使用ref
const tableColumn = ref([
  { label: '日期', prop: 'date' },
  { label: '姓名', prop: 'name' },
  { label: '操作', custom: 'set', width: 150 },
]);

const tableData = ref([
  { date: '2022-05-20', name: '张三', id: 1 },
  { date: '2022-05-21', name: '李四', id: 2 },
]);

const multipleSelection = ref([]);
const clickHandle = (row) => {
  console.log('row: ', row);
};

</script>

<style>
</style>

batchTable组件

props

属性类型使用说明
tableColumnArray{ lable:'日期', prop: 'date'}
tableDataArray:tableData 或者 v-model:tableData="data"
pageNumberv-model:page="current"
sizeNumber每页显示的条数
keyIdString设置选择的唯一值,默认id
model-value / v-modelArray选择的数组
selectListArray已选择的列表

其他参数看element官网

tableColumn参数说明

Props说明类型
custom自定义内容插槽string
header自定义表头插槽string
width对应列的宽度string
minWidth对应列的最小宽度string
sortable对应列是否可以排序boolean
fixed列是否固定在左侧left或者右侧right, true 表示固定在左侧string / boolean

event

事件说明回调参数
current-change当用户切换分页的触发该事件currengPage
sort-change点击排序触发{ prop, order, currentPage, column }

KDialog

<template>
  <K-dialog title="提示" v-model="visible" />
</template>

<script setup>
import { ref } from 'vue';

const visible = ref(true);
</script>

props

属性类型使用说明
showFooterBoolean是否显示footer,默认false

event

事件说明回调参数
confirm当用户点击确认触发该事件
open打开对话框的时候触发
close关闭对话框的时候触发

slots

插槽名说明插槽作用域
footerfooter内容

KTabs

首先要配置路由,name值要和路由名一致,切换路由自动跳转,刷新默认当前路由

如果没有配置路由,请使用elmentPlus tabs

<template>
  <k-tabs :tabs-list="tabsList" @tab-click="tabClick" />
</template>

<script setup>
import { ref } from 'vue';

const tabsList = ref([
  { label: '全部', name: 'all' },
  { label: '正常', name: 'normal' },
  { label: '已拉黑', name: 'block' },
]);
const tabClick = (name) => {
  console.log('name: ', name);
};
</script>

props

属性类型使用说明
tabsListArray
typeString类型

event

事件说明回调参数
tab-click当用户点击确认触发该事件
change路由改变的触发

slots

插槽名说明插槽作用域
-右侧的内容

KPicker

props

属性类型使用说明
modelValueArray勾选的列表
tableColumnArray{ lable:'日期', prop: 'date'}
tableDataArray:tableData 或者 v-model:tableData="data"
currentPageNumberv-model="current"
selectListArray已选择的列表
keyIdString设置选择的唯一值,默认id
keyNameString设置选择的名字参数,默认pName

其他参数看element官网

tableColumn参数说明

Props说明类型
custom自定义插槽string
width对应列的宽度string
minWidth对应列的最小宽度string
sortable对应列是否可以排序boolean
1.2.0

3 years ago

1.2.8

3 years ago

1.1.9

3 years ago

1.2.7

3 years ago

1.1.8

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.1.6

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.4.0

3 years ago

1.2.2

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.3.0-alpha.6

3 years ago

1.3.0-alpha.5

3 years ago

1.2.8-alpha.1

3 years ago

1.3.0-alpha.8

3 years ago

1.3.0-alpha.7

3 years ago

1.3.0-alpha.10

3 years ago

1.3.0-alpha.11

3 years ago

1.3.0-alpha.9

3 years ago

1.3.0-alpha.12

3 years ago

1.2.8-alpha.2

3 years ago

1.3.0-alpha.13

3 years ago

1.3.0-alpha.14

3 years ago

1.2.9

3 years ago

1.3.0-alpha.2

3 years ago

1.3.0-alpha.1

3 years ago

1.3.0-alpha.4

3 years ago

1.3.0-alpha.3

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

0.1.5

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago