Home > php教程 > PHP开发 > Interesting bootstrap walking progress bar

Interesting bootstrap walking progress bar

高洛峰
Release: 2016-12-03 10:04:46
Original
1530 people have browsed it

This tutorial teaches you how to make a "walking" bootstrap progress bar for your reference. The specific content is as follows

1. Page effect:

Starting position:

Interesting bootstrap walking progress bar

After clicking the "Go" button

2 .html code:

<div>
<div class="progress progress-striped active">
 <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" v-bind:style="progressStyle">进度条</div>
</div>
<button type=&#39;button&#39; v-on:click=&#39;queryEnterprise&#39; class=&#39;btn btn-primary&#39;>走</button>
</div>
Copy after login

v-bind:style="progressStyle"

Bind inline style:

a. Object syntax: The object syntax of v-bind:style is very intuitive - it looks very like CSS, Actually it is a JavaScript object. CSS property names can be named in camelCase or kebab-case:

eg:

html:

<div v-bind:style="{ color: activeColor, fontSize: fontSize + &#39;px&#39; }"></div>
Copy after login

js:

data: {
 activeColor: &#39;red&#39;,
 fontSize: 30
}
Copy after login

directly bound to a Style objects are usually better and make the template clearer:

html:

<div v-bind:style="styleObject"></div>
Copy after login

js:

data: {
 styleObject: {
 color: &#39;red&#39;,
 fontSize: &#39;13px&#39;
 }
}
Copy after login

b. Array syntax: The array syntax of v-bind:style can combine multiple style objects Applied to an element:

eg:

html:

<div v-bind:style="[styleObjectA, styleObjectB]">
Copy after login
data: {
 styleObjectA: {
 color: &#39;red&#39;
 },
 styleObjectB:{
 fontSize: &#39;13px&#39;
 }
}
Copy after login

c. Automatically add prefix: When v-bind:style uses CSS properties that require vendor prefixes, such as transform, Vue.js will automatically Detect and add the appropriate prefix.

3.js code:

<script>
export default {
 components:{},
 props:{},
  ready:function(){},
  computed:{},
  methods:{
   queryEnterprise:function(){
    if(parseInt(this.progressStyle.width)<100){
     this.progressStyle.width=parseInt(this.progressStyle.width)+30+&#39;%&#39;;
    }else{
     alert("进度条已经走完");
    }
   }
  },
 data () {
  return {
   //进度条样式
    progressStyle:{
     width:&#39;10%&#39;,
    },
  }
 },
 
}
</script>
Copy after login

4.style

.progress {
 height: 40px;
 transition: 3s;
}
.progress-bar {
 font-size: 16px;
 line-height: 40px;
}
Copy after login

The above is the entire content of this article, I hope it will be helpful to everyone’s study


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template