[新增] progress 进度条

This commit is contained in:
就眠仪式 2021-09-28 09:42:28 +08:00
parent eec76e2cb1
commit 2b8fc4758d
8 changed files with 53 additions and 7 deletions

View File

@ -1,7 +1,7 @@
::: demo ::: demo
<template> <template>
<lay-input></lay-input> <lay-input v-model="data"></lay-input>{{data}}
</template> </template>
<script> <script>
@ -10,7 +10,10 @@ import { ref } from 'vue'
export default { export default {
setup() { setup() {
const data = ref("内容");
return { return {
data
} }
} }
} }

View File

@ -1,12 +1,19 @@
::: demo ::: demo
<template> <template>
默认分割线
<lay-line></lay-line> <lay-line></lay-line>
赤色分割线
<lay-line theme="red"></lay-line> <lay-line theme="red"></lay-line>
橙色分割线
<lay-line theme="orange"></lay-line> <lay-line theme="orange"></lay-line>
墨绿分割线
<lay-line theme="green"></lay-line> <lay-line theme="green"></lay-line>
青色分割线
<lay-line theme="cyan"></lay-line> <lay-line theme="cyan"></lay-line>
蓝色分割线
<lay-line theme="blue"></lay-line> <lay-line theme="blue"></lay-line>
黑色分割线
<lay-line theme="black"></lay-line> <lay-line theme="black"></lay-line>
</template> </template>

View File

@ -0,0 +1,21 @@
::: demo
<template>
<lay-progress percent="80"></lay-progress>
<br>
<lay-progress percent="60"></lay-progress>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
return {
}
}
}
</script>
:::

View File

@ -16,6 +16,7 @@
<li><router-link to="/zh-CN/components/badge">徽章</router-link></li> <li><router-link to="/zh-CN/components/badge">徽章</router-link></li>
<li><router-link to="/zh-CN/components/block">区块</router-link></li> <li><router-link to="/zh-CN/components/block">区块</router-link></li>
<li><router-link to="/zh-CN/components/line">分割</router-link></li> <li><router-link to="/zh-CN/components/line">分割</router-link></li>
<li><router-link to="/zh-CN/components/progress">进度</router-link></li>
</ul> </ul>
</lay-side> </lay-side>
<lay-body> <lay-body>

View File

@ -64,6 +64,11 @@ const zhCN = [
path: '/zh-CN/components/line', path: '/zh-CN/components/line',
component: () => import('../../docs/zh-CN/components/line.md'), component: () => import('../../docs/zh-CN/components/line.md'),
meta: { title: '分割' }, meta: { title: '分割' },
},
{
path: '/zh-CN/components/progress',
component: () => import('../../docs/zh-CN/components/progress.md'),
meta: { title: '进度' },
} }
], ],
}, },

View File

@ -16,7 +16,7 @@ import LayHeader from "./module/header/index"
import LayFooter from "./module/footer/index" import LayFooter from "./module/footer/index"
import LayLogo from "./module/logo/index" import LayLogo from "./module/logo/index"
import LayPanel from "./module/panel/index" import LayPanel from "./module/panel/index"
import LayProgress from "./module/panel/index" import LayProgress from "./module/progress/index"
import LayCol from "./module/col/index" import LayCol from "./module/col/index"
import LayRow from "./module/row/index" import LayRow from "./module/row/index"
import LayInput from "./module/input/index" import LayInput from "./module/input/index"

View File

@ -1,12 +1,21 @@
<template> <template>
<input type="text" class="layui-input" /> <input :type="type" :value="modelValue" :name="name" class="layui-input" @input="updateValue"/>
</template> </template>
<script setup name="LayInput" lang="ts"> <script setup name="LayInput" lang="ts">
import { defineProps } from '@vue/runtime-core' import { defineProps, defineEmits } from '@vue/runtime-core'
const props = const props =
defineProps<{ defineProps<{
name?: string
type?: string type?: string
modelValue?: string
}>() }>()
const emit = defineEmits(['update:modelValue'])
const updateValue = function(event: unknown,value: unknown) {
emit('update:modelValue', value)
}
</script> </script>

View File

@ -6,12 +6,12 @@
:style="[ :style="[
this.color ? 'background-color: ' + this.color : '', this.color ? 'background-color: ' + this.color : '',
{ {
width: this.percentage + '%', width: this.percent + '%',
}, },
]" ]"
> >
<span v-if="showText" class="layui-progress-text"> <span v-if="showText" class="layui-progress-text">
{{ text ? text : this.percentage + '%' }} {{ text ? text : this.percent + '%' }}
</span> </span>
</div> </div>
</div> </div>
@ -21,7 +21,7 @@ import { defineProps } from '@vue/runtime-core'
const props = const props =
defineProps<{ defineProps<{
percentage: Number percent: Number
theme: String theme: String
color: String color: String
size: String size: String