TomVision
TomVision
  • 发布:2015-12-18 11:09
  • 更新:2018-05-16 20:41
  • 阅读:3567

mui.fire 传递过来的自定义事件无法执行

分类:MUI
mui
window.addEventListener('select_village',function(event){  
    alert("1")  
    var sv = document.getElementById('sv');  
    sv.style.display = 'none'  
});  

能执行alert,但是dom的操作不行,能读取到dom

2015-12-18 11:09 2 条评论 负责人:无 分享
已邀请:
TomVision

TomVision (作者)

有人帮忙看下么 QAQ

DCloud_UNI_FXY

DCloud_UNI_FXY

发个测试工程

niunan222

niunan222 - 没有什么网站不是数据库增删查改做不了的!!!

是的。。。我现在弄的自定义事件。。。里面alert是可以的。。但是dom操作就不行。。

全栈工程师

全栈工程师 - 精通mui、uniapp,承接相关项目外包,解决各种疑难问题。有任何问题可以随时联系,QQ:419761282

楼主解决了吗?我现在也遇到这样的问题

  • niunan222

    我不用自定义事件了,而是用 打开窗口参数的方式

    //新闻列表中的内容点击事件

    mui('.mui-table-view').on('tap', '.mui-table-view-cell', function() {

    var newsid = this.getAttribute('newsid');


                    //打开新闻详情  
    mui.openWindow({
    id: 'detail',
    url: 'new-content.html',
    extras: {
    newsid: newsid
    }
    });
    })

    //新闻详情页的代码

    <script>

    mui.plusReady(function() {

    var newsid = plus.webview.currentWebview().newsid;

    if(parseInt(newsid)) {

    var url = remoteurl + "news/getcontent?newsid=" + newsid;

    mui.post(url, {}, function(data) {

    //console.log("新闻详情页远程返回:"+JSON.stringify(data));

    document.getElementById("news_content").innerHTML = data.content;

    document.getElementById("news_time").innerHTML = data.time;

    document.getElementById("news_title").innerHTML = data.title;


                    }, 'json')  
    }
    });
    </script>

    2018-05-21 09:46

  • x***@163.com

    解决了吗?

    2019-06-06 16:36

该问题目前已经被锁定, 无法添加新回复