Slider doc added

pull/12/head
Merve Özçifçi 2019-03-26 17:01:28 +03:00
parent 39b113fa9f
commit 4187e348ec
3 changed files with 254 additions and 16 deletions

View File

@ -13,9 +13,6 @@ import DomHandler from '../utils/DomHandler';
export default { export default {
props: { props: {
value: [Number,Array], value: [Number,Array],
disabled: Boolean,
step: Number,
range: Boolean,
min: { min: {
type: Number, type: Number,
default: 0 default: 0
@ -27,7 +24,10 @@ export default {
orientation: { orientation: {
type: String, type: String,
default: 'horizontal' default: 'horizontal'
} },
step: Number,
range: Boolean,
disabled: Boolean
}, },
dragging: false, dragging: false,
handleIndex: null, handleIndex: null,

View File

@ -12,7 +12,7 @@
<Slider v-model="value1" /> <Slider v-model="value1" />
<h3>Input: {{value2}}</h3> <h3>Input: {{value2}}</h3>
<p-inputtext v-model.number="value2" /> <InputText v-model.number="value2" />
<Slider v-model="value2" /> <Slider v-model="value2" />
<h3>Step: {{value3}}</h3> <h3>Step: {{value3}}</h3>
@ -24,10 +24,14 @@
<h3>Vertical: {{value5}}</h3> <h3>Vertical: {{value5}}</h3>
<Slider v-model="value5" orientation="vertical" /> <Slider v-model="value5" orientation="vertical" />
</div> </div>
<SliderDoc/>
</div> </div>
</template> </template>
<script> <script>
import SliderDoc from './SliderDoc';
export default { export default {
data() { data() {
return { return {
@ -37,6 +41,9 @@ export default {
value4: [20,80], value4: [20,80],
value5: 50 value5: 50
} }
},
components: {
'SliderDoc': SliderDoc
} }
} }
</script> </script>

View File

@ -0,0 +1,231 @@
<template>
<div class="content-section documentation">
<TabView>
<TabPanel header="Documentation">
<h3>Import</h3>
<CodeHighlight lang="javascript">
import Slider from 'primevue/slider';
</CodeHighlight>
<h3>Getting Started</h3>
<p>Two-way binding is defined using the standard v-model directive.</p>
<CodeHighlight>
&lt;Slider v-model=&quot;value&quot; /&gt;
</CodeHighlight>
<h3>Range</h3>
<p>Range slider provides two handles to define two values. Enable <i>range</i> property and bind an array to implement a range slider.</p>
<CodeHighlight>
&lt;Slider v-model=&quot;value&quot; :range=&quot;true&quot; /&gt;
</CodeHighlight>
<CodeHighlight lang="js">
export default {
data() {
return {
value: [20,80]
}
}
}
</CodeHighlight>
<h3>Orientation</h3>
<p>Default layout of slider is horizontal, use <i>orientation</i> property for the alternative vertical mode.</p>
<CodeHighlight>
&lt;Slider v-model=&quot;value&quot; orientation=&quot;vertical&quot; /&gt;
</CodeHighlight>
<h3>Step</h3>
<p>Step factor is 1 by default and can be customized with step option.</p>
<CodeHighlight>
&lt;Slider v-model=&quot;value&quot; :step=&quot;20&quot; /&gt;
</CodeHighlight>
<h3>Min-Max</h3>
<p>Boundaries are specified with min and max attributes.</p>
<CodeHighlight>
&lt;Slider v-model=&quot;value&quot; :step=&quot;20&quot; :min=&quot;50&quot; :max=&quot;200&quot; /&gt;
</CodeHighlight>
<h3>Properties</h3>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>value</td>
<td>number</td>
<td>0</td>
<td>Value of the component.</td>
</tr>
<tr>
<td>min</td>
<td>number</td>
<td>0</td>
<td>Mininum boundary value.</td>
</tr>
<tr>
<td>max</td>
<td>number</td>
<td>100</td>
<td>Maximum boundary value.</td>
</tr>
<tr>
<td>orientation</td>
<td>string</td>
<td>horizontal</td>
<td>Orientation of the slider, valid values are horizontal and vertical.</td>
</tr>
<tr>
<td>step</td>
<td>number</td>
<td>1</td>
<td>Step factor to increment/decrement the value.</td>
</tr>
<tr>
<td>range</td>
<td>boolean</td>
<td>false</td>
<td>When speficed, allows two boundary values to be picked.</td>
</tr>
<tr>
<td>disabled</td>
<td>boolean</td>
<td>false</td>
<td>When present, it specifies that the component should be disabled.</td>
</tr>
</tbody>
</table>
</div>
<h3>Events</h3>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Name</th>
<th>Parameters</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>change</td>
<td>event: New value.</td>
<td>Callback to invoke on value change via slide.</td>
</tr>
<tr>
<td>input</td>
<td>event: New value.</td>
<td>Callback to invoke on value change via slide.</td>
</tr>
<tr>
<td>slideEnd</td>
<td>event.originalEvent: Slide event <br />
event.value: New value.
</td>
<td>Callback to invoke when slide ends.</td>
</tr>
</tbody>
</table>
</div>
<h3>Styling</h3>
<p>Following is the list of structural style classes, for theming classes visit <router-link to="/theming">theming</router-link> page.</p>
<div class="doc-tablewrapper">
<table class="doc-table">
<thead>
<tr>
<th>Name</th>
<th>Element</th>
</tr>
</thead>
<tbody>
<tr>
<td>p-slider</td>
<td>Container element</td>
</tr>
<tr>
<td>p-slider-handle</td>
<td>Handle element.</td>
</tr>
</tbody>
</table>
</div>
<h3>Dependencies</h3>
<p>None.</p>
</TabPanel>
<TabPanel header="Source">
<a href="https://github.com/primefaces/primevue/tree/master/src/views/slider" class="btn-viewsource" target="_blank" rel="noopener noreferrer">
<span>View on GitHub</span>
</a>
<CodeHighlight>
<template v-pre>
&lt;template&gt;
&lt;div&gt;
&lt;div class=&quot;content-section introduction&quot;&gt;
&lt;div class=&quot;feature-intro&quot;&gt;
&lt;h1&gt;Slider&lt;/h1&gt;
&lt;p&gt;Slider is an input component to provide a numerical input.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;content-section implementation&quot;&gt;
&lt;h3 class=&quot;first&quot;&gt;Basic: {{value1}}&lt;/h3&gt;
&lt;Slider v-model=&quot;value1&quot; /&gt;
&lt;h3&gt;Input: {{value2}}&lt;/h3&gt;
&lt;InputText v-model.number=&quot;value2&quot; /&gt;
&lt;Slider v-model=&quot;value2&quot; /&gt;
&lt;h3&gt;Step: {{value3}}&lt;/h3&gt;
&lt;Slider v-model=&quot;value3&quot; :step=&quot;20&quot; /&gt;
&lt;h3&gt;Range: {{value4}}&lt;/h3&gt;
&lt;Slider v-model=&quot;value4&quot; :range=&quot;true&quot; /&gt;
&lt;h3&gt;Vertical: {{value5}}&lt;/h3&gt;
&lt;Slider v-model=&quot;value5&quot; orientation=&quot;vertical&quot; /&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/template&gt;
</template>
</CodeHighlight>
<CodeHighlight lang="javascript">
export default {
data() {
return {
value1: null,
value2: 50,
value3: 20,
value4: [20,80],
value5: 50
}
}
}
</CodeHighlight>
<CodeHighlight lang="css">
.p-slider-horizontal, .p-inputtext {
width: 14em;
}
.p-slider-vertical {
height: 14em;
}
</CodeHighlight>
</TabPanel>
</TabView>
</div>
</template>