Range Slider Svelte Component(レンジスライダー・Svelte・コンポーネント

    Range Slider Svelteコンポーネントは、Range Sliderコンポーネントを表します。

    Range Slider コンポーネント

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

    • Range

    レンジスライダーのプロパティ

    PropTypeDefaultDescription
    <Range> properties
    initbooleantrueレンジスライダの初期化
    valuenumber
    array
    string
    レンジスライダの値。デュアルレンジスライダの場合は配列でなければならない。
    minnumber
    string
    最小値
    maxnumber
    string
    最大値
    stepnumber
    string
    1値の間の最小ステップ
    labelbooleanfalseレンジスライダのノブの周りにラベルを表示
    dualbooleanfalseデュアルレンジスライダを有効にする
    verticalbooleanfalse垂直方向のレンジスライダを有効にする
    verticalReversedbooleanfalse垂直方向のレンジスライダを反転させます。(vertical:true の場合のみ)
    draggableBarbooleantrue有効にすると、レンジバーのクリックやスワイプでレンジスライダーを操作することができます(値の変更)。
    formatLabelfunction(value)メソッドはフォーマットされたレンジノブのラベルテキストを返さなければなりません。引数として、ラベルの値を受け取ります。
    scalebooleanfalseレンジスライダーのスケールを有効にする
    scaleStepsnumber5スケールのステップ数
    scaleSubStepsnumber0スケールのサブステップの数(各ステップはこの値で分割されます
    formatScaleLabelfunction (value)メソッドはフォーマットされたスケール値を返さなければならない。引数として、現在のスケールステップ値を受け取ります。このメソッドは、各スケールステップごとに呼び出されます。
    limitKnobPositionbooleanノブの位置をレンジバーの大きさに制限します。デフォルトでは、iOSテーマから有効になっています。
    disabledbooleanfalse範囲スライダを無効にするかどうかを定義します。
    idstringレンジスライダーの要素ID属性
    inputbooleanfalse有効にすると、input type="range" 要素を内部にもレンダリングします。
    inputIdstring入力要素のID属性
    namestring入力要素の "name "属性

    レンジスライダーのイベント

    EventDescription
    <Range> events
    rangeChangeレンジスライダーの値が変更されるとイベントが発生します。
    rangeChangedスライダーの値が変更された後、スライダーのノブが離されるとイベントが発生します。

    Examples

    <Page>
      <Navbar title="Range Slider"></Navbar>
    
      <BlockTitle>Volume</BlockTitle>
      <List simpleList>
        <ListItem>
          <ListItemCell class="width-auto flex-shrink-0">
            <Icon ios="f7:speaker_fill" aurora="f7:speaker_fill" md="material:volume_mute"></Icon>
          </ListItemCell>
          <ListItemCell class="flex-shrink-3">
            <Range
              min={0}
              max={100}
              step={1}
              value={10}
            ></Range>
          </ListItemCell>
          <ListItemCell class="width-auto flex-shrink-0">
            <Icon ios="f7:speaker_3_fill" aurora="f7:speaker_3_fill" md="material:volume_up"></Icon>
          </ListItemCell>
        </ListItem>
      </List>
    
      <BlockTitle>Brightness</BlockTitle>
      <List simpleList>
        <ListItem>
          <ListItemCell class="width-auto flex-shrink-0">
            <Icon ios="f7:sun_min" aurora="f7:sun_min" md="material:brightness_low"></Icon>
          </ListItemCell>
          <ListItemCell class="flex-shrink-3">
            <Range
              min={0}
              max={100}
              step={1}
              value={50}
              label={true}
              color="orange"
            ></Range>
          </ListItemCell>
          <ListItemCell class="width-auto flex-shrink-0">
            <Icon ios="f7:sun_max_fill" aurora="f7:sun_max_fill" md="material:brightness_high"></Icon>
          </ListItemCell>
        </ListItem>
      </List>
    
      <BlockTitle class="display-flex justify-content-space-between">
        <span>Price Filter</span>
        <span>${priceMin} - ${priceMax}</span>
      </BlockTitle>
      <List simpleList>
        <ListItem>
          <ListItemCell class="width-auto flex-shrink-0">
            <Icon ios="f7:money_dollar_circle" aurora="f7:money_dollar_circle" md="material:attach_money"></Icon>
          </ListItemCell>
          <ListItemCell class="flex-shrink-3">
            <Range
              min={0}
              max={500}
              step={1}
              value={[priceMin, priceMax]}
              label={true}
              dual={true}
              color="green"
              onRangeChange={onPriceChange}
            ></Range>
          </ListItemCell>
          <ListItemCell class="width-auto flex-shrink-0">
            <Icon ios="f7:money_dollar_circle_fill" aurora="f7:money_dollar_circle_fill" md="material:monetization_on"></Icon>
          </ListItemCell>
        </ListItem>
      </List>
    
      <BlockTitle>With Scale</BlockTitle>
      <Block strong>
        <Range
          min={0}
          max={100}
          label={true}
          step={5}
          value={25}
          scale={true}
          scaleSteps={5}
          scaleSubSteps={4}
        />
      </Block>
    
      <BlockTitle>Vertical</BlockTitle>
      <Block strong class="display-flex justify-content-center">
        <Range
          class="margin-right"
          style="height: 160px"
          vertical={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={25}
        />
        <Range
          class="margin-horizontal"
          style="height: 160px"
          vertical={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={50}
        />
        <Range
          class="margin-horizontal"
          style="height: 160px"
          vertical={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={75}
        />
        <Range
          class="margin-left"
          style="height: 160px"
          dual={true}
          vertical={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={[25, 75]}
        />
      </Block>
    
      <BlockTitle>Vertical Reversed</BlockTitle>
      <Block strong class="display-flex justify-content-center">
        <Range
          class="margin-right"
          color="red"
          style="height: 160px"
          vertical={true}
          verticalReversed={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={25}
        />
        <Range
          class="margin-horizontal"
          color="red"
          style="height: 160px"
          vertical={true}
          verticalReversed={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={50}
        />
        <Range
          class="margin-horizontal"
          color="red"
          style="height: 160px"
          vertical={true}
          verticalReversed={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={75}
        />
        <Range
          class="margin-left"
          color="red"
          style="height: 160px"
          dual={true}
          vertical={true}
          verticalReversed={true}
          min={0}
          max={100}
          label={true}
          step={1}
          value={[25, 75]}
        />
      </Block>
    </Page>
      
    
    
    <script>
      import {Page, Navbar, BlockTitle, List, ListItem, ListItemCell, Icon, Range, Block} from 'framework7-svelte';
    
      let priceMin = 200;
      let priceMax = 400;
    
      function onPriceChange(values) {
        priceMin = values[0];
        priceMax = values[1];
      }
    </script>