由index.w点击某个图片,转到adetail,希望每次adetail加载时,取到参数id
index.w
<tbody class="x-list-template" xid="listTemplate3">
<tr xid="tr4">
<td xid="td6" class="tdd" bind-click="{"operation":"shell.showPage","args":{"url":"js:$model.toUrl('./adetail.w?id=1')"}}">
<a><img alt="" xid="image22"
class="img-rounded img-responsive center-block" src="./img/a1.png"/></a>
<div xid="div15" class="text text-center">
<h4 xid="h43" class="text-white">宠物蛇</h4>
<h5 xid="h54" class="text-danger">¥2922</h5>
<div style="height:20px;"></div>
</div>
</td>
<td xid="td7" class="tdd" bind-click="{"operation":"shell.showPage","args":{"url":"js:$model.toUrl('./adetail.w?id=2')"}}">
<a><img alt="" xid="image23"
class="img-rounded img-responsive center-block" src="./img/a2.png"/></a>
<div xid="div17" class="text text-center">
<h4 xid="h44" class="text-white">蛋龟</h4>
<h5 xid="h55" class="text-danger">¥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;" xid="window" sysParam="false">
<div component="$UI/system/components/justep/model/model" xid="model" style="left:18px;top:83px;height:244px;" onActive="doActive();"/>
<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;
});