🔥 新プロジェクトのご紹介 t0ggles -究極のプロジェクト管理ツール! 🔥

レンジスライダー Vue コンポーネント

レンジスライダーコンポーネント

以下のコンポーネントが含まれています。

  • レンジ

レンジプロパティ

名前デフォルト説明
colorsオブジェクト

Tailwind CSSカラークラスを持つオブジェクト

colors.thumbBgIos文字列`range-thumb:bg-white`
colors.thumbBgMaterial文字列`range-thumb:bg-md-light-primary dark:range-thumb:bg-md-dark-primary`
colors.valueBgIos文字列`bg-primary`
colors.valueBgMaterial文字列`bg-md-light-primary dark:bg-md-dark-primary`
component文字列`div`

コンポーネントのHTML要素

disabledブール値false

レンジ入力の無効化を定義します。

inputId文字列

レンジ入力のid属性

max数値100

レンジの最大値

min数値0

レンジの最小値

name文字列

レンジ入力の名前

readonlyブール値false

レンジ入力が読み取り専用かどうかを定義します。

step数値1

レンジのステップ

value任意

レンジの値

レンジイベント

名前説明
blurfunction(e)

`blur`イベントハンドラ

changefunction(e)

`change`イベントハンドラ

focusfunction(e)

`focus`イベントハンドラ

inputfunction(e)

`input`イベントハンドラ

RangeSlider.vue
<template>
<k-page>
<k-navbar title="Range Slider" />
<k-block-title>Volume: {{ volume }}</k-block-title>
<k-block-header>From 0 to 100 with step 10</k-block-header>
<k-list strong inset-material outline-ios>
<k-list-item inner-class="flex space-x-4 rtl:space-x-reverse">
<template #inner>
<span>0</span>
<k-range
:value="volume"
:step="10"
@input="(e) => (volume = parseInt(e.target.value, 10))"
/>
<span>100</span>
</template>
</k-list-item>
</k-list>
<k-block-title>Price: ${{ price }}</k-block-title>
<k-block-header>From 0 to 1000 with step 1</k-block-header>
<k-list strong inset-material outline-ios>
<k-list-item inner-class="flex space-x-4 rtl:space-x-reverse">
<template #inner>
<span>$0</span>
<k-range
:value="price"
:step="1"
:min="0"
:max="1000"
@input="(e) => (price = parseInt(e.target.value, 10))"
/>
<span>$1000</span>
</template>
</k-list-item>
</k-list>
<k-block-title>
Color: rgb({{ red }}, {{ green }}, {{ blue }})
</k-block-title>
<k-list strong inset-material outline-ios>
<k-list-item>
<template #inner>
<k-range
class="k-color-brand-red"
:value="red"
:step="1"
:min="0"
:max="255"
@input="(e) => (red = parseInt(e.target.value, 10))"
/>
</template>
</k-list-item>
<k-list-item>
<template #inner>
<k-range
class="k-color-brand-green"
:value="green"
:step="1"
:min="0"
:max="255"
@input="(e) => (green = parseInt(e.target.value, 10))"
/>
</template>
</k-list-item>
<k-list-item>
<template #inner>
<k-range
class="k-color-brand-blue"
:value="blue"
:step="1"
:min="0"
:max="255"
@input="(e) => (blue = parseInt(e.target.value, 10))"
/>
</template>
</k-list-item>
</k-list>
</k-page>
</template>
<script>
import { ref } from 'vue';
import {
kPage,
kNavbar,
kNavbarBackLink,
kBlockTitle,
kBlockHeader,
kList,
kListItem,
kRange,
} from 'konsta/vue';
export default {
components: {
kPage,
kNavbar,
kNavbarBackLink,
kBlockTitle,
kBlockHeader,
kList,
kListItem,
kRange,
},
setup() {
const volume = ref(50);
const price = ref(150);
const red = ref(100);
const green = ref(50);
const blue = ref(75);
return {
volume,
price,
red,
green,
blue,
};
},
};
</script>
ライセンス MIT.
2022 © Konsta UI by nolimits4web.