tnblog
首页
视频
资源
登录

MUI 页面传值

4683人阅读 2019/11/18 22:27 总访问:108837 评论:4 收藏:0 手机
分类: MUI

根据想要传的值来传到对应的页面去

像这样的

 <div class=" am-list-main">
     <h3 class="am-list-item-hd pet_list_one_bt" >
                <a  v-bind:id="item.id" v-bind:name="item.userName"  class="test"> {{item.title}}</a>
     </h3>
        <div class="am-list-item-text pet_list_two_text">{{item.sContent}}</div>
</div>

之后根据所在的层次来找到传值的位置

  mui("body").on('tap','.test',function(){
                            
                 var id=this.getAttribute("id");
                            
                 var  username=this.getAttribute("name")
                 //打开想要传值的相应页面
                   mui.openWindow({
                        id: "article_dedetails",
                        url: "article_dedetails.html",  
                       extras: {  
                           //自定义扩展参数,可以用来处理页面间传值  
                           uid:id,
                           username:username  
                            }
                            });
                         }); 

                对应页面接收

        //B页面onload从服务器获取列表数据;
        window.onload = function(){
            //注意:若为ajax请求,则需将如下代码放在处理完ajax响应数据之后;
            mui.plusReady(function(){
                var self = plus.webview.currentWebview();//获取界面webview
                var uid = self.uid;
                var name = self.username;
           
                       var  vm;
                       mui.get('http://api/v1/s/'+name+'/'+uid,{category: 'news'},function(data){
                          vm=new Vue({
                             el:"#content",
                           data:{
                           articlelist: data.value
                                     },filters: {
                               //处理头像
                               parsehead: function(head) {
               
                               return head;
                                }
                             }
                          })
                             }, 'json');

                //关闭等待框
                plus.nativeUI.closeWaiting();
                //显示当前页面
                mui.currentWebview.show();
            });
        }

                


评价
希望你懂得很多之后,依旧热爱生活
排名
6
文章
6
粉丝
16
评论
8
{{item.articleTitle}}
{{item.blogName}} : {{item.content}}
ICP备案 :渝ICP备18016597号-1
网站信息:2018-2024TNBLOG.NET
技术交流:群号656732739
联系我们:contact@tnblog.net
公网安备:50010702506256
欢迎加群交流技术