【问题标题】:SyncFusion TreeGrid ContextMenu doesn't seem to work with vue3SyncFusion TreeGrid ContextMenu 似乎不适用于 vue3
【发布时间】:2022-08-23 18:52:46
【问题描述】:

我正在尝试向我的 SyncFusion TreeGrid 添加上下文菜单,但似乎没有任何反应。 这是我的文件的样子:

<template>
<ej2-treegrid
    :dataSource=\"tabla\"
    :contextMenuItems=\"contextMenuItems\"
    rowHeight=\"20px\"
    ><e-columns>
        <e-column field=\"nombre\" headerText=\"Nombre\"></e-column>
        <e-column field=\"cantidad\" headerText=\"Cantidad\"></e-column>
        <e-column field=\"vu\" headerText=\"Valor Unitario\" format=\"C\"></e-column>
        <e-column field=\"precio\" headerText=\"Precio\" format=\"C\"></e-column>
    </e-columns>
</ej2-treegrid>
</template>

<script setup>
import { ref, reactive, provide } from \"vue\";
import { TreeGridComponent as ej2Treegrid,
    ColumnsDirective as eColumns,
    ColumnDirective as eColumn,
    ContextMenu,
} from \'@syncfusion/ej2-vue-treegrid\';

provide(\"treegrid\", [ContextMenu]);

const contextMenuItems = [\"Cancel\"];

const tabla = reactive([{id: 1, nombre: \"\", cantidad: 2, vu: 2, precio: 2}]);
</script>

我不确定我做错了什么。也许是提供部分?该文档似乎适用于 vue2。

当我右键单击网格时,会出现默认的上下文菜单。我在编辑时遇到过类似的问题。

    标签: vue.js vuejs3 syncfusion vue-composition-api


    【解决方案1】:

    根据您的查询,我们怀疑您面临上下文菜单问题(右键单击时,它会显示默认上下文菜单)。我们怀疑上下文菜单模块没有正确注入。根据您共享的代码示例,我们进行了检查,提供部分返回错误。因此,我们建议您按照下面的代码示例进行操作。

    你的代码:

    provide("treegrid", [ContextMenu]);
    

    修改后的代码:

    provide: {
      treegrid: [Page, ContextMenu, Edit,],
    }
    

    我们准备了一个带有上下文菜单和编辑的简单 Vue3 示例。
    请参考以下示例: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Vue_3_context_menu-200508808

    请回复我们以获得进一步的帮助。

    问候, 法文苏丹娜 T

    【讨论】:

    • 你和法文签约,你写成“我们”——为什么?
    猜你喜欢
    • 2020-04-04
    • 2023-04-06
    • 2017-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多