Handsontable表格的select组件 - vue版本

GitHub - handsontable/handsontable: JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡ - GitHub - handsontable/handsontable: JavaScript data grid with a spreadsheet look & feel. Works with React, Angular, and Vue. Supported by the Handsontable team ⚡https://github.com/handsontable/handsontableHandsontable 一款纯前端的Excel(spread)组件,功能强大,有非商用许可。

在使用Handsontable过程中,下拉组件不好用, 所以自己写了一个组件。

<template>
    <div class="myIview2" :style="isRenderer ? 'height: 100%; display: flex; align-content: center;' : ''">
        <div
            v-if="isEditor && isVisible"
            id="PickerElement"
            :style="style"
            class="mys-select-dropdown"
            @mousedown="stopPropagation"
            @click="stopPropagation"
        >
            <ul class="mys-select-dropdown-list">
<!--                <li><div class="mys-select-search"><input class="mys-input" placeholder="请输入检索" @keydown.enter=""></input></div></li>-->
                <li v-for="(item, index) in myOptions"
                    :key="'itt'+index"
                    @click.prevent="()=>{selectItem(item)}"
                    :class="'mys-select-item' + (item.value == value ? ' mys-select-selected' : '') + (index == selectIndex ? ' mys-select-item-focus' : '')"
                >{{item.label}}</li>
            </ul>
        </div>
        <div v-if="isRenderer" style="width: 100%; display: flex; align-items: center; align-content: center; justify-content: space-between">
            <!--           直接调用方法获取文字。可以解决value变动时主动刷新的问题,支持表格本来的拖动填充、复制粘贴操作。减少使用watch时的资源占用 -->
            <!--           但是,通过cellMeta手动变更下拉选项后,页面将无法实时更新 -->
            <!--            <span class="mys-select-text">{{text}}</span>-->
            <span class="mys-select-text">{{getValueText()}}</span>
            <i class="mys-icon ivu-icon-ios-arrow-down mys-select-arrow1" @click="openPanelToEdit"></i>
        </div>
    </div>
</template>

...

效果图如下:

 

组件地址(赚点积分用):

 https://download.csdn.net/download/sun283211093/86726736

基于以上组件,尚存在以下几个小问题:

  1. 提供on-select 事件,以便外部能够获取选中数据以及在选中后做一些其他操作。但是 这个事件在外边好像没有拿到,不知为啥,所以代码中暂时去掉了
  2. 存在一定几率,会出现单元格对应的变量值清空了,但是页面还是有值
  3. 如果想用级联方式,只能在外部进行操作
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sun283211093

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值