Home  >  Article  >  Web Front-end  >  Vue drop-down list implementation method

Vue drop-down list implementation method

php中世界最好的语言
php中世界最好的语言Original
2018-05-10 13:37:175005browse

这次给大家带来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
}

 

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

vue-router懒加载解决首次加载速度缓慢步骤详解

angular2模块与共享模块使用方法

The above is the detailed content of Vue drop-down list implementation method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn