[新增] rate 组件

This commit is contained in:
就眠仪式 2021-10-04 08:06:19 +08:00
parent 2fb6d43e39
commit 98626cdbd6
6 changed files with 67 additions and 1 deletions

View File

@ -0,0 +1,19 @@
::: demo
<template>
<lay-rate></lay-rate>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
return {
}
}
}
</script>
:::

View File

@ -84,6 +84,7 @@ export default {
{ id: 23, title: '头像',subTitle:"avatar" ,path: '/zh-CN/components/avatar' }, { id: 23, title: '头像',subTitle:"avatar" ,path: '/zh-CN/components/avatar' },
{ id: 24, title: '字段',subTitle:"field" ,path: '/zh-CN/components/field' }, { id: 24, title: '字段',subTitle:"field" ,path: '/zh-CN/components/field' },
{ id: 25, title: '空',subTitle:"empty" ,path: '/zh-CN/components/empty' }, { id: 25, title: '空',subTitle:"empty" ,path: '/zh-CN/components/empty' },
{ id: 26, title: '评分',subTitle:"rate" ,path: '/zh-CN/components/rate' },
] ]
const selected = ref(1) const selected = ref(1)

View File

@ -131,6 +131,11 @@ const zhCN = [
path: '/zh-CN/components/empty', path: '/zh-CN/components/empty',
component: () => import('../../docs/zh-CN/components/empty.md'), component: () => import('../../docs/zh-CN/components/empty.md'),
meta: { title: '空' }, meta: { title: '空' },
},
{
path: '/zh-CN/components/rate',
component: () => import('../../docs/zh-CN/components/rate.md'),
meta: { title: '评分' },
} }
], ],
}, },

View File

@ -44,6 +44,7 @@ import LaySelectOption from './module/selectOption/index'
import LayScroll from './module/scroll/index' import LayScroll from './module/scroll/index'
import LayEmpty from './module/empty/index' import LayEmpty from './module/empty/index'
import LayFormItem from './module/formItem/index' import LayFormItem from './module/formItem/index'
import LayRate from './module/rate/index'
const components: Record<string, IDefineComponent> = { const components: Record<string, IDefineComponent> = {
LayRadio, LayRadio,
@ -86,7 +87,8 @@ const components: Record<string, IDefineComponent> = {
LayScroll, LayScroll,
LaySelectOption, LaySelectOption,
LayEmpty, LayEmpty,
LayFormItem LayFormItem,
LayRate
} }
const install = (app: App, options?: InstallOptions): void => { const install = (app: App, options?: InstallOptions): void => {
@ -143,6 +145,7 @@ export {
LaySelectOption, LaySelectOption,
LayEmpty, LayEmpty,
LayFormItem, LayFormItem,
LayRate,
install, install,
} }

9
src/module/rate/index.ts Normal file
View File

@ -0,0 +1,9 @@
import type { App } from 'vue'
import Component from './index.vue'
import type { IDefineComponent } from '../type/index'
Component.install = (app: App) => {
app.component(Component.name || 'LayRate', Component)
}
export default Component as IDefineComponent

29
src/module/rate/index.vue Normal file
View File

@ -0,0 +1,29 @@
<template>
<ul class="layui-rate">
<li class="layui-inline">
<i class="layui-icon layui-icon-rate-solid"></i>
</li>
<li class="layui-inline">
<i class="layui-icon layui-icon-rate-solid"></i>
</li>
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
<li class="layui-inline"><i class="layui-icon layui-icon-rate"></i></li>
</ul>
</template>
<script setup lang="ts">
import { defineProps, ref, withDefaults } from 'vue'
const rate = ref([])
const props = withDefaults(
defineProps<{
length?: number
modelValue?: number
}>(),
{
length: 5,
modelValue: 0
}
)
</script>