>  기사  >  php教程  >  흥미로운 부트스트랩 걷기 진행률 표시줄

흥미로운 부트스트랩 걷기 진행률 표시줄

高洛峰
高洛峰원래의
2016-12-03 10:04:461477검색

이 튜토리얼에서는 참조용으로 "걷는" 부트스트랩 진행률 표시줄을 만드는 방법을 설명합니다.

1. 페이지 효과:

시작 위치:

흥미로운 부트스트랩 걷기 진행률 표시줄

"이동" 버튼 클릭 후

2.html 코드:

<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"

바인드 인라인 스타일:

a. 객체 구문: v-bind:style의 객체 구문은 매우 직관적입니다. CSS와 매우 비슷해 보이지만 실제로는 JavaScript 객체입니다. CSS 속성 이름은 camelCase 또는 kebab-case로 지정할 수 있습니다.

예:

html:

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

js:

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

일반적으로 스타일 개체에 직접 바인딩하여 템플릿을 더 명확하게 만드는 것이 좋습니다.

html:

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

js:

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

b .Array 구문: 배열 구문 v-bind:style은 요소에 여러 스타일 객체를 적용할 수 있습니다:

예:

html:

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

c. 자동으로 접두사 추가: v-bind:style이 변환과 같은 공급업체 접두사가 필요한 CSS 속성을 사용하는 경우 Vue.js는 해당 접두사를 자동으로 감지하고 추가합니다.

3.js 코드:

<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;
}

위 내용은 이 글의 전체 내용입니다. 모든 분들의 공부에 도움이 되었으면 좋겠습니다


성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.