-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Some methods were incorrectly defined as computed, these have now been moved to methods. - the rating watcher did not set selectedRating to the prop value, which has now been fixed. - An extra example has been added to example.html.
- Loading branch information
Showing
5 changed files
with
55 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ When using require or import you will need to make sure you can compile `ES6` (s | |
|
||
A `dist` file has also been created, which you can include in your webpage like so: | ||
|
||
<script src="https://unpkg.com/[email protected].0/dist/star-rating.js"></script> | ||
<script src="https://unpkg.com/[email protected].1/dist/star-rating.js"></script> | ||
|
||
The `star-rating` component is registered automatically, so there is no need to manually register the component. | ||
|
||
|
@@ -91,6 +91,10 @@ The following props can be passed to the component: | |
</star-rating> | ||
``` | ||
|
||
### Reactive Props | ||
|
||
The `rating` prop is reactive, meaning that if you bind it to data in your parent view model, any change to that value will automatically feed through to the component. It's important to note that if you want to use this functionality you will have to manually sync data between the parent and child. | ||
|
||
### Custom Events | ||
|
||
`vue-star-rating` fires the following custom events, simply use `v-on:event` or the `@` shortand to capture the event. | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,21 +6,19 @@ | |
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script> | ||
<script src="../dist/star-rating.js"></script> | ||
<style> | ||
|
||
body{ | ||
body { | ||
font-size: 1.2em; | ||
} | ||
|
||
.rating-text { | ||
font-weight:bold; | ||
font-size: 1.9em; | ||
border: 1px solid #cfcfcf; | ||
padding-left:10px; | ||
padding-right:10px; | ||
border-radius: 5px; | ||
color: #999; | ||
font-weight: bold; | ||
font-size: 1.9em; | ||
border: 1px solid #cfcfcf; | ||
padding-left: 10px; | ||
padding-right: 10px; | ||
border-radius: 5px; | ||
color: #999; | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
|
@@ -71,6 +69,12 @@ <h2>Capture Mouse Over Rating</h2> | |
<star-rating :show-rating="false" @current-rating="showCurrentRating" @rating-selected="setCurrentSelectedRating" :increment="0.5"></star-rating> | ||
</div> | ||
<div style="margin-top:10px;font-weight:bold;">{{currentRating}}</div> | ||
|
||
<h2>Resetable stars</h2> | ||
<div style="display:inline-block;"> | ||
<star-rating :rating="resetableRating" @rating-selected="syncRating"></star-rating> | ||
<div style="padding-top:10px;cursor:pointer;margin-bottom:20px;color: blue;"><a @click="reset">Reset Rating</a></div> | ||
</div> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
|
@@ -85,12 +89,19 @@ <h2>Capture Mouse Over Rating</h2> | |
}, | ||
setCurrentSelectedRating: function(rating) { | ||
this.currentSelectedRating = "You have Selected: " + rating + " stars"; | ||
}, | ||
reset: function() { | ||
this.resetableRating = 0; | ||
}, | ||
syncRating: function(rating) { | ||
this.resetableRating = rating; | ||
} | ||
}, | ||
data: { | ||
rating: "No Rating Selected", | ||
currentRating: "No Rating", | ||
currentSelectedRating: "No Current Rating" | ||
currentSelectedRating: "No Current Rating", | ||
resetableRating: 3 | ||
} | ||
}); | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters