我正在使用Cordova + Framework 7
function sendOnSocket( str ){
success = tlsClientSocket.write(strToSend, () => {
console.log("FLUSHED");
});
}
,index
,page1
page2
按钮。我必须重新加载索引页面,go page1
按钮才能正常工作。routes.js
go page1
第1页,第2页中的返回按钮
{
path: '/page1/',
async: function (routeTo, routeFrom, resolve, reject) {
axios.get('').then(response => {
var data = response.data;
resolve({
componentUrl: './pages/page1.html'
}, {
context: {
data: data,
}
});
})
}
}, {
path: '/page2/:id',
async: function (routeTo, routeFrom, resolve, reject) {
axios.get('' + id).then(function (response) {
var data = response.data;
resolve({
componentUrl: './pages/page2.html'
}, {
context: {
data: data
}
});
})
}
}
按钮转到index.html中的第1页
.html
<a href="#" class="back link" data-force="true">
<img src="img/icon-back.png" alt="">
</a>
.js
<a href="#" class="button button-raised button-fill" id="go-page1">go page1</a>
按钮转到第1页的第2页
$$('#go-page1').on('click', function () {
app.views.main.router.navigate('/page1/');
}
答案 0 :(得分:1)
您可以通过以下解决方案将其解决:
1)
$$('#go-page1').on('click', function () {
app.views.main.router.navigate('/page1/', {reloadCurrent: true});
}
2)或html链接
<a class="back" data-ignore-cache="true" data-force="true">back</a>
3)忽略缓存/历史记录或通过reloadPrevious刷新上一页,如下所示:
mainView.router.back({url: 'index.html', force: true, ignoreCache: true,reload: true});