效果如下

 


涉及框架

1、vue.js

2、bootstrap框架


实现功能的代码如下

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"> 
	<title>Bootstrap 实例 - 按钮组的大小</title>
	<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">  
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>

<div class="btn-group btn-group-sm" id='app'>

	<button type="button" class="btn btn-default" @click = "counter--"  v-if="counter>0">-</button>
	<button type="button" class="btn btn-default"> {{ counter }}</button>
	<button type="button" class="btn btn-default" @click = "counter++">+</button>
<button type="button" class="btn btn-primary">¥{{ counter*dj }}</button>
	</div>

<script type = "text/javascript">
var vm = new Vue({
    el: '#app',
    data: {
        counter: 1,
		dj:25
    }
});
</script>
</body>
</html>

 

Logo

前往低代码交流专区

更多推荐