vue实现下拉菜单树

作者:单飞吧 时间:2024-05-09 15:18:39 

本文实例为大家分享了vue实现下拉菜单树的具体代码,供大家参考,具体内容如下

效果:使用 Vue-Treeselect 实现

vue实现下拉菜单树

建议通过npm安装vue-treeselect,并使用webpack之类的捆绑器来构建您的应用程序。


npm install --save @riophae/vue-treeselect

官网实例 配置属性请查看官网


<!-- Vue SFC -->
<template>
<div id="app">
<treeselect v-model="value" :multiple="true" :options="options" />
</div>
</template>

<script>
// import the component
import Treeselect from '@riophae/vue-treeselect'
// import the styles
import '@riophae/vue-treeselect/dist/vue-treeselect.css'

export default {
// register the component
components: { Treeselect },
data() {
 return {
 // define the default value
 value: null,
 // define options
 options: [ {
  id: 'a',
  label: 'a',
  children: [ {
  id: 'aa',
  label: 'aa',
  }, {
  id: 'ab',
  label: 'ab',
  } ],
 }, {
  id: 'b',
  label: 'b',
 }, {
  id: 'c',
  label: 'c',
 } ],
 }

},
}
</script>

更多教程点击《Vue.js前端组件学习教程》,欢迎大家学习阅读。

关于vue.js组件的教程,请大家点击专题vue.js组件学习教程进行学习。

来源:https://blog.csdn.net/weixin_44640323/article/details/109174222

标签:vue,下拉菜单
0
投稿

猜你喜欢

  • MySQL Administrator 登录报错的解决方法

    2024-01-21 06:53:06
  • MySQL 5.5.x my.cnf参数配置优化详解

    2024-01-27 02:12:48
  • Python及PyCharm下载与安装教程

    2022-10-04 08:19:54
  • 简单介绍Python中的round()方法

    2023-05-01 11:57:10
  • 微信公众号支付之坑:调用支付jsapi缺少参数 timeStamp等错误解决方法

    2024-05-11 09:16:42
  • Python sklearn预测评估指标混淆矩阵计算示例详解

    2023-12-19 23:39:21
  • PyQt5 designer 页面点击按钮跳转页面实现

    2023-02-24 14:12:48
  • 服务器端jupyter notebook映射到本地浏览器的操作

    2023-10-30 12:06:20
  • python输出决策树图形的例子

    2022-02-07 09:14:54
  • Python Numpy实现计算矩阵的均值和标准差详解

    2021-12-20 09:51:20
  • Python统计词频并绘制图片(附完整代码)

    2022-01-01 09:28:24
  • 彻底搞懂Python字符编码

    2023-10-14 01:05:03
  • Python如何telnet到网络设备

    2023-11-20 09:47:45
  • python 装饰器功能与用法案例详解

    2023-12-22 12:42:34
  • python实现猜单词游戏

    2023-01-22 22:32:43
  • 搭建pypi私有仓库实现过程详解

    2023-02-02 09:14:35
  • Python轻松破解加密压缩包教程详解

    2021-04-12 13:26:45
  • python GUI库图形界面开发之PyQt5信号与槽事件处理机制详细介绍与实例解析

    2021-03-23 03:49:14
  • Django框架用户注销功能实现方法分析

    2021-07-22 17:58:08
  • python 3利用BeautifulSoup抓取div标签的方法示例

    2023-09-17 02:57:48
  • asp之家 网络编程 m.aspxhome.com