Skip to content
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

How to use/configure this package, on single index.html page without npm? #96

Open
zarpio opened this issue May 21, 2020 · 1 comment
Open

Comments

@zarpio
Copy link

zarpio commented May 21, 2020

Following is my code, just want to configure vue-progressbar on this single page directly without NPM.

Problem: Unable to configure progress bar component.

Body:

<div id="app">
     <ul>
          <li v-for="goal in goals">{{ goal.title }}</li>
     </ul>
     <vue-progress-bar></vue-progress-bar>
</div>

Js:

        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue-progressbar@0.7.5/dist/vue-progressbar.min.js"></script>
	<script type="text/javascript">
	new Vue({
	    el: '#app',
	    components: {
	        vue-progress-bar: window['vue-progressbar']
	    },
	    data: {
	    	goals: {},
	    	page: 1
	    },
	    mounted() {
			this.getGoals();
		},
	    methods: {
			getGoals(page = 1) {
				this.$Progress.start();
			    axios.get('/api/goals?page=' + page)
			        .then(response => {
			            this.goals.page = page;
			            this.goals.list = response.data;
			            this.$Progress.finish();
			        });
			},
	    }
	});
	</script>
@zarpio
Copy link
Author

zarpio commented May 22, 2020

By the way, I have found myself... it was easy now it is working fine... as following.

<div class="row" id="app" >
    <vue-progress-bar></vue-progress-bar>
    ....
</div>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue-progressbar@0.7.5/dist/vue-progressbar.min.js"></script>

<script>
Vue.use(VueProgressBar, {
    color: '#bffaf3',
    failedColor: '#ff0000',
    thickness: '5px'
});
new Vue({
    el: '#app',
    ...
)};
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant