选择具有自动完成,插槽,引导程序和材料设计主题的主题。
v3.5.2(07/31/2020)
# Yarn
$ yarn add vue-cool-select
# NPM
$ npm install vue-cool-select --save
导入此插件css(主题),然后通过添加插件Vue.use
:
import { CoolSelectPlugin } from 'vue-cool-select'
// 粘贴线以下只有当你需要“bootstrap”的主题
import 'vue-cool-select/dist/themes/bootstrap.css'
// 粘贴下面只有在订单您需要“material-design”主题
import 'vue-cool-select/dist/themes/material-design.css'
// 您也可以导入主题
Vue.use(CoolSelectPlugin)
在另一个组件内使用:
import { CoolSelect } from 'vue-cool-select'
export default {
components: { CoolSelect },
data () {
return {
// 简单的例子
items: ['Item 1', 'Item 2', 'Item 3'],
// 将有一个选定的项目
selected: null
}
}
}
添加到<template>
:
<cool-select
v-model="selected"
:items="items"
/>
在页面中包括vue-cool-select。
<script src="https://unpkg.com/vue-cool-select"></script>
<!-- paste the line below only if you need "bootstrap" theme -->
<link rel="stylesheet" href="https://unpkg.com/vue-cool-select/dist/themes/bootstrap.css">
<!-- paste the line below only if you need "material-design" theme -->
<link rel="stylesheet" href="https://unpkg.com/vue-cool-select/dist/themes/material-design.css">
如果在页面中检测到Vue,则插件将自动安装。