只需使用vue-strap中的select,在这里:http://yuche.github.io/vue-strap/#select
文档中写了几种安装方式,在这里:https://github.com/yuche/vue-strap#installation
好像都挺麻烦的,要这样那样打包,
不能像cdn那样引入一个文件浏览器就可以直接运行吗?
文档的几种方法中相比较而言哪个最方便?
补充:
下面是我的demo,用cdn方式测试一下,好像哪里没弄对,不能显示:
这个图是官网示例显示:
demo代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link href="//cdn.bootcss.com/bootstrap/4.0.0-alpha.2/css/bootstrap.min.css" rel="stylesheet">
<link href="//cdn.bootcss.com/tether/1.3.2/css/tether.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="card">
<h3 class="card-header">Select</h3>
<div class="card-block">
<div class="row">
<div class="col-sm-4">
<div id="app">
<!--http://yuche.github.io/vue-strap/#select 第一个单选示例-->
<v-select>
<v-option value="Apple">Apple</v-option>
<v-option value="Banana">Banana</v-option>
<v-option value="Cherry">Cherry</v-option>
<v-option value="Orange">Orange</v-option>
<v-option value="Grape">Grape</v-option>
</v-select>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="//cdn.bootcss.com/jquery/2.2.3/jquery.min.js"></script>
<script src="//cdn.bootcss.com/tether/1.3.2/js/tether.min.js"></script>
<script src="//cdn.bootcss.com/bootstrap/4.0.0-alpha.2/js/bootstrap.min.js"></script>
<script src="//cdn.bootcss.com/vue/1.0.24/vue.min.js"></script>
<script src="//cdn.bootcss.com/vue-strap/1.0.11/vue-strap.min.js"></script>
<script>
var vm = new Vue({
components: {
Select: VueStrap.Select
},
el: "#app",
data: {
showRight: false,
showTop: false
}
});
</script>
</body>
</html>
npm install vue-strap
cdn 也有
https://cdnjs.com/libraries/vue-strap
个人感觉 npm比较方便 ,但是上线的话还是CDN可以有效减少流量