feat: add page component v-model props
This commit is contained in:
parent
8400cc879e
commit
569d081553
@ -13,7 +13,7 @@
|
||||
::: demo 使用 `lay-page` 标签, 创建分页
|
||||
|
||||
<template>
|
||||
<lay-page :limit="limit" @limit="limit = $event" :total="total" :show-page="showPage"></lay-page>
|
||||
<lay-page v-model="currentPage" :limit="limit" @limit="limit = $event" :total="total" :show-page="showPage"></lay-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -25,11 +25,13 @@ export default {
|
||||
const limit = ref(20)
|
||||
const total = ref(100)
|
||||
const showPage = ref(true)
|
||||
const currentPage = ref(2);
|
||||
|
||||
return {
|
||||
limit,
|
||||
total,
|
||||
showPage
|
||||
showPage,
|
||||
currentPage
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,8 @@ export default {
|
||||
|
||||
const page = {
|
||||
total: 100,
|
||||
limit: 10
|
||||
limit: 10,
|
||||
current: 2
|
||||
}
|
||||
|
||||
const change = function({ current }){
|
||||
|
@ -1,95 +1,3 @@
|
||||
<template>
|
||||
<lay-dropdown>
|
||||
<div class="layui-unselect layui-colorpicker">
|
||||
<span>
|
||||
<span
|
||||
class="layui-colorpicker-trigger-span"
|
||||
lay-type=""
|
||||
:style="`background-color: ${colorObj.rgba}`"
|
||||
>
|
||||
<i class="layui-icon layui-colorpicker-trigger-i layui-icon-down"></i>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<template #content>
|
||||
<div class="layui-color-picker">
|
||||
<div
|
||||
class="saturation-value"
|
||||
ref="saturationValue"
|
||||
@mousedown="mousedownSV"
|
||||
>
|
||||
<div :style="`background-color: hsl(${hue}, 100%, 50%);`">
|
||||
<div class="point" :style="pointStyle"></div>
|
||||
</div>
|
||||
<div class="saturation-value-2"></div>
|
||||
<div class="saturation-value-3"></div>
|
||||
</div>
|
||||
<div class="layui-color-picker-middle">
|
||||
<div style="flex: auto">
|
||||
<div class="hue-slider" ref="hueSlider" @mousedown="mousedownHue">
|
||||
<div class="slider" :style="hueSliderStyle"></div>
|
||||
</div>
|
||||
<div
|
||||
class="alpha-slider"
|
||||
ref="alphaSlider"
|
||||
@mousedown="mousedownAlpha"
|
||||
>
|
||||
<div class="slider" :style="alphaSliderStyle"></div>
|
||||
<div
|
||||
:style="`background: linear-gradient(to right, rgba(0,0,0,0), ${colorObj.rgb});width: 100%;height: 100%`"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="color-diamond">
|
||||
<div
|
||||
:style="`background-color: ${colorObj.rgba};width: 100%;height: 100%;box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), inset 0 0 4px rgba(0, 0, 0, .25);`"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="color-value">
|
||||
<div class="hex">
|
||||
<label>
|
||||
<input
|
||||
:value="colorObj.hex8"
|
||||
@input="hexChange"
|
||||
spellcheck="false"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-r">
|
||||
<label>
|
||||
<input :value="red" @input="redChange" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-g">
|
||||
<label>
|
||||
<input :value="green" @input="greenChange" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-b">
|
||||
<label>
|
||||
<input :value="blue" @input="blueChange" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-a">
|
||||
<label>
|
||||
<input :value="alpha" @input="alphaChange" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="preset">
|
||||
<li
|
||||
v-for="item in preset"
|
||||
:key="item"
|
||||
:style="`background-color: ${item}`"
|
||||
@click="presetChange(item)"
|
||||
></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</lay-dropdown>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LayColorPicker",
|
||||
@ -484,3 +392,95 @@ function hex2rgba(s: any) {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<lay-dropdown>
|
||||
<div class="layui-unselect layui-colorpicker">
|
||||
<span>
|
||||
<span
|
||||
class="layui-colorpicker-trigger-span"
|
||||
lay-type=""
|
||||
:style="`background-color: ${colorObj.rgba}`"
|
||||
>
|
||||
<i class="layui-icon layui-colorpicker-trigger-i layui-icon-down"></i>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<template #content>
|
||||
<div class="layui-color-picker">
|
||||
<div
|
||||
class="saturation-value"
|
||||
ref="saturationValue"
|
||||
@mousedown="mousedownSV"
|
||||
>
|
||||
<div :style="`background-color: hsl(${hue}, 100%, 50%);`">
|
||||
<div class="point" :style="pointStyle"></div>
|
||||
</div>
|
||||
<div class="saturation-value-2"></div>
|
||||
<div class="saturation-value-3"></div>
|
||||
</div>
|
||||
<div class="layui-color-picker-middle">
|
||||
<div style="flex: auto">
|
||||
<div class="hue-slider" ref="hueSlider" @mousedown="mousedownHue">
|
||||
<div class="slider" :style="hueSliderStyle"></div>
|
||||
</div>
|
||||
<div
|
||||
class="alpha-slider"
|
||||
ref="alphaSlider"
|
||||
@mousedown="mousedownAlpha"
|
||||
>
|
||||
<div class="slider" :style="alphaSliderStyle"></div>
|
||||
<div
|
||||
:style="`background: linear-gradient(to right, rgba(0,0,0,0), ${colorObj.rgb});width: 100%;height: 100%`"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="color-diamond">
|
||||
<div
|
||||
:style="`background-color: ${colorObj.rgba};width: 100%;height: 100%;box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), inset 0 0 4px rgba(0, 0, 0, .25);`"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="color-value">
|
||||
<div class="hex">
|
||||
<label>
|
||||
<input
|
||||
:value="colorObj.hex8"
|
||||
@input="hexChange"
|
||||
spellcheck="false"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-r">
|
||||
<label>
|
||||
<input :value="red" @input="redChange" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-g">
|
||||
<label>
|
||||
<input :value="green" @input="greenChange" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-b">
|
||||
<label>
|
||||
<input :value="blue" @input="blueChange" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="rgba-a">
|
||||
<label>
|
||||
<input :value="alpha" @input="alphaChange" />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="preset">
|
||||
<li
|
||||
v-for="item in preset"
|
||||
:key="item"
|
||||
:style="`background-color: ${item}`"
|
||||
@click="presetChange(item)"
|
||||
></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</lay-dropdown>
|
||||
</template>
|
@ -235,6 +235,7 @@ onMounted(() => {
|
||||
<LayPage
|
||||
:total="page.total"
|
||||
:limit="page.limit"
|
||||
v-model="page.current"
|
||||
show-page
|
||||
show-limit
|
||||
show-skip
|
||||
|
Loading…
Reference in New Issue
Block a user