Rating doc added
parent
e658d5ac77
commit
2d56117759
|
@ -10,12 +10,12 @@
|
|||
export default {
|
||||
props: {
|
||||
value: Number,
|
||||
disabled: Boolean,
|
||||
readonly: Boolean,
|
||||
stars: {
|
||||
type: Number,
|
||||
default: 5
|
||||
},
|
||||
readonly: Boolean,
|
||||
disabled: Boolean,
|
||||
cancel: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
|
|
@ -20,16 +20,23 @@
|
|||
<h3>Disabled</h3>
|
||||
<Rating :value="8" :disabled="true" :stars="10" />
|
||||
</div>
|
||||
|
||||
<RatingDoc/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import RatingDoc from './RatingDoc';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
val1: null,
|
||||
val2: 3,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'RatingDoc': RatingDoc
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,183 @@
|
|||
<template>
|
||||
<div class="content-section documentation">
|
||||
<TabView>
|
||||
<TabPanel header="Documentation">
|
||||
<h3>Import</h3>
|
||||
<CodeHighlight lang="javascript">
|
||||
import Rating from 'primevue/rating';
|
||||
</CodeHighlight>
|
||||
|
||||
<h3>Getting Started</h3>
|
||||
<p>Two-way value binding is defined using v-model.</p>
|
||||
<CodeHighlight>
|
||||
<Rating v-model="val" />
|
||||
</CodeHighlight>
|
||||
|
||||
<h3>Number of Stars</h3>
|
||||
<p>Number of stars to display is defined with <i>stars</i> property, default is 5.</p>
|
||||
<CodeHighlight>
|
||||
<Rating v-model="val" :stars="7"/>
|
||||
</CodeHighlight>
|
||||
|
||||
<h3>Cancel</h3>
|
||||
<p>A cancel icon is displayed to reset the value by default, set <i>cancel</i> as false to remove this option.</p>
|
||||
<CodeHighlight>
|
||||
<Rating v-model="val" :cancel="false" />
|
||||
</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>null</td>
|
||||
<td>Value of the rating.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>disabled</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>When present, it specifies that the element should be disabled.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>readonly</td>
|
||||
<td>boolean</td>
|
||||
<td>false</td>
|
||||
<td>When present, changing the value is not possible.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>stars</td>
|
||||
<td>number</td>
|
||||
<td>5</td>
|
||||
<td>Number of stars.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cancel</td>
|
||||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>When specified a cancel icon is displayed to allow removing the value.</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.originalEvent: Browser event <br />
|
||||
event.value: selected value
|
||||
</td>
|
||||
<td>Callback to invoke on value change.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>input</td>
|
||||
<td>event: selected value
|
||||
</td>
|
||||
<td>Callback to invoke on value change.</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-rating</td>
|
||||
<td>Container element</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-rating-star</td>
|
||||
<td>Star element</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-rating-star-on</td>
|
||||
<td>Selected star element.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>p-rating-cancel</td>
|
||||
<td>Cancel icon.</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/rating" class="btn-viewsource" target="_blank" rel="noopener noreferrer">
|
||||
<span>View on GitHub</span>
|
||||
</a>
|
||||
<CodeHighlight>
|
||||
<template v-pre>
|
||||
<template>
|
||||
<div>
|
||||
<div class="content-section introduction">
|
||||
<div class="feature-intro">
|
||||
<h1>Rating</h1>
|
||||
<p>Rating component is a star based selection input.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="content-section implementation">
|
||||
<h3 class="first">Basic {{val1}}</h3>
|
||||
<Rating v-model="val1" />
|
||||
|
||||
<h3>No Cancel {{val2}}</h3>
|
||||
<Rating v-model="val2" :cancel="false" />
|
||||
|
||||
<h3>ReadOnly</h3>
|
||||
<Rating :value="5" :readonly="true" :stars="10" :cancel="false" />
|
||||
|
||||
<h3>Disabled</h3>
|
||||
<Rating :value="8" :disabled="true" :stars="10" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</CodeHighlight>
|
||||
|
||||
<CodeHighlight lang="javascript">
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
val1: null,
|
||||
val2: 3,
|
||||
}
|
||||
}
|
||||
}
|
||||
</CodeHighlight>
|
||||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
</template>
|
Loading…
Reference in New Issue