这次给大家带来vue下拉列表实现方法,vue下拉列表实现的注意事项有哪些,下面就是实战案例,一起来看一下。
喜欢的请反手来个star,有issue的欢迎提出
安装
cnpm install vue-droplist --save
组件中导入
import droplist from 'vue-droplist'
// 显示下拉列表
showdroplist() {
// 配置信息
const configdata = {
position: { // 设置显示位置
top: '',
right: '',
bottom: '',
left: ''
},
width: '40%', // 设置宽度
list: [ // 设置下拉列表数据和对应的点击事件
{text: '修改资料', action: this.updateuserinfo},
{text: '更换主题', action: this.updatetheme},
{text: '退出账号', action: this.signout}
...
],
isshow: true //设置显示,默认false
}
droplist(configdata) //执行配置信息
},
updateuserinfo() {
//do something
},
updatetheme() {
//do something
},
signout() {
//do something
}
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
推荐阅读:
vue-router懒加载解决首次加载速度缓慢步骤详解
angular2模块与共享模块使用方法
以上就是vue下拉列表实现方法的详细内容。