onShowMenu: function (e, menu) {//右键 var prAttentionState = $(e.currentTarget).attr("prAttentionState"); //销售编号 var ptIssueState = $(e.currentTarget).attr("ptIssueState"); var ptAuditState = $(e.currentTarget).attr("ptAuditState"); var ptExistsIssue = $(e.currentTarget).attr("ptExistsIssue"); var oldtag = $(e.currentTarget).attr("oldtag"); var expoOpenedTag = $(e.currentTarget).attr("expoOpenedTag"); if (prAttentionState == "0") { $("#CancelAttention", menu).remove(); } else { $("#Attention", menu).remove(); } //start xww 2016-12-29 #6312 发布搭建模板菜单 /*if (ptAuditState != "3" && ptExistsIssue != "1") { $("#IssueTemplate", menu).remove(); } if (ptExistsIssue == "1") { $("#IssueTemplate", menu).remove(); }*/ //end xww 2016-12-29 if (ptIssueState != "1") { $("#EmportExeclDaJian", menu).remove(); } if (oldtag != "1") { $("#CollectionData", menu).remove(); } if (expoOpenedTag == "1") { $("#ExpoTag", menu).remove(); } else { $("#CancelExpoTag", menu).remove(); } return menu; }
时间: 2024-02-10 10:28:32 浏览: 40
这段代码是一个 `onShowMenu` 函数,用于在右键点击时显示上下文菜单。该函数接受两个参数:`e` 是事件对象,`menu` 是要显示的菜单。
在函数内部,它使用 jQuery 获取 `e.currentTarget` 元素的多个属性值,并将它们分别赋给变量。具体的属性包括:
- `prAttentionState`:销售编号
- `ptIssueState`
- `ptAuditState`
- `ptExistsIssue`
- `oldtag`
- `expoOpenedTag`
接下来,根据这些属性的值对菜单进行操作。根据不同的条件,它可能会移除菜单中的某些选项。
最后,函数返回菜单对象。
请注意,该代码中有一些注释被注释掉了,这可能是因为它们暂时不需要或不适用于特定的上下文。
相关问题
var ptIssueState = $(e.currentTarget).attr("ptIssueState");
这段代码是使用 jQuery 获取 `e.currentTarget` 元素的 `ptIssueState` 属性的值,并将其赋给变量 `ptIssueState`。
```javascript
var ptIssueState = $(e.currentTarget).attr("ptIssueState");
```
在这里,`$(e.currentTarget)` 是将事件对象 `e` 的当前目标元素转换为 jQuery 对象,然后使用 `.attr("ptIssueState")` 方法获取元素的 `ptIssueState` 属性的值。
请确保在使用这段代码之前,已经加载了 jQuery 库,并且事件对象 `e` 是有效的。另外,确保目标元素具有 `ptIssueState` 属性。
todetail: function(e) { var item=e.currentTarget.dataset.item; console.log(item.id) wx.navigateTo({ url: '../guanka/guanka?gid='+item.id+"&gname="+item.name, })
这段代码使用了小程序的事件绑定机制,当用户点击页面上的某个元素时,该函数会被触发并传入一个事件对象e。其中e.currentTarget表示当前触发事件的元素,e.currentTarget.dataset可以获取该元素上绑定的所有自定义属性,本段代码通过e.currentTarget.dataset.item获取到自定义属性item,并从中获取到item.id作为跳转页面时所需的参数。最后使用wx.navigateTo函数跳转到guanka页面,并将所需的参数以query string的形式传递过去。具体来说,该函数跳转到../guanka/guanka页面,并在url末尾加上gid和gname两个参数,值分别为item.id和item.name。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)