【发布时间】: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