由index.w点击某个图片,转到adetail,希望每次adetail加载时,取到参数id

index.w

<tbody class="x-list-template" x>
<tr x>
<td x>
<a><img alt="" x
class="img-rounded img-responsive center-block" src="./img/a1.png"/></a>
<div x>
<h4 x>宠物蛇</h4>
<h5 x>¥2922</h5>
<div style="height:20px;"></div>
</div>
</td>
<td x>
<a><img alt="" x
class="img-rounded img-responsive center-block" src="./img/a2.png"/></a>
<div x>
<h4 x>蛋龟</h4>
<h5 x>¥2129</h5>
<div style="height:20px;"></div>
</div>
</td>
....
 
index.js

...

 

adetail.w

<?xml version="1.0" encoding="utf-8"?>

<div xmlns="http://www.w3.org/1999/xhtml" class="main13" component="$UI/system/components/justep/window/window"
design="device:m;" x>
<div component="$UI/system/components/justep/model/model" x/>
<div component="$UI/system/components/justep/panel/panel" class="x-panel x-full x-card">
<div class="x-panel-top">
....
 
adetail.js
define(function(require) {
    var $ = require("jquery");
    var justep = require("$UI/system/lib/justep");
    var comUtil = require("$UI/system/components/justep/common/common");

    var Model = function() {
        this.callParent();
    };
 
Model.prototype.doActive = function(event) {
        console.log('onActive');
        var context = this.getContext();
 
//获取URL中的参数
        var id = context.getRequestParameter('id');
        console.log(id);
    }
return Model;
});

相关文章: