Home  >  Article  >  php教程  >  Interesting bootstrap walking progress bar

Interesting bootstrap walking progress bar

高洛峰
高洛峰Original
2016-12-03 10:04:461477browse

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>

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>

js:

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

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

html:

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

js:

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

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]">
data: {
 styleObjectA: {
 color: &#39;red&#39;
 },
 styleObjectB:{
 fontSize: &#39;13px&#39;
 }
}

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>

4.style

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

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


Statement:
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