-
Notifications
You must be signed in to change notification settings - Fork 27
Watch progress
and fill
to fit Vue style.
#25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
928a5a1
to
d7289e4
Compare
progress
and fill
to fit Vue style.
@kuanyui Thanks for your efforts. I'll review and publish this soon. 👏 |
@@ -88,6 +88,12 @@ export default { | |||
.on('circle-inited', function(event){ | |||
renderCircleBody(this, (vm.progress/vm.scale)); | |||
vm.$emit('vue-circle-init', event); | |||
vm.$watch('progress', (nv) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put these watcher methods into the "watched" property?
watch: {
fill(nv) {
this.updateFill(nv);
},
progress(nv) {
this.updateProgress(nv);
},
},
That will help with keep the functions more intentional/declarative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you update the demo and the readme?
in App.vue you can do something like:
redraw(){
this.p = Math.floor(Math.random() * 100) + 1;
}
and
progress(event,progress,stepValue){
console.log(stepValue);
if (stepValue > 30) {
this.fill = '#e3f218';
}
},
and we can bump the version and publish when it's compiled
Idk if this'll help anyone seeing the repo has been inactive for a while, but I made a fork and integrated these changes so fill, emptyFill, and progress are all reactive. Started updating the docs too to reflect all of the possible props you can use: |
Thanks for this JQuery plugin wrapper.
I found the default behavior of this component is a little confusing for developer, that developer must call method in this component via
$refs
to update theprogress
, that's quite strange for a Vue plugin. So I add a watch forprogress
and user should need not to callupdateProgress()
manually anymore in most scenarios, and this behavior should be more like a Vue plugin which is reactive to the changes of data model.I didn't build dist in this PR because I encountered the error of "You are using the runtime-only build of Vue..." (so you may need to check the issue #15 first for the dist...)
At last I
import VueCircle from 'vue2-circle-progress/src/index.vue'
directly and it works great.