刷新两次的问题可能是因为在刷新时触发了两次刷新事件。以下是解决该问题的一种方法:
- 在刷新事件之前,先移除原有的刷新事件监听器。
$('#window').window({ onBeforeRefresh: function(){ $(this).window('clear'); $(this).window('refresh', 'newContent.html'); $(this).window('un', 'refresh'); } });
- 在刷新事件监听器中,先清空窗口内容,然后再重新刷新窗口。
这样就可以确保只有一次刷新事件。