|
@@ -72,7 +72,15 @@ const router = useRouter()
|
|
|
|
|
|
|
|
// 返回上一页
|
|
// 返回上一页
|
|
|
const goBack = () => {
|
|
const goBack = () => {
|
|
|
- router.push('/home')
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 直接使用window.location.href确保页面立即跳转并刷新
|
|
|
|
|
+ window.location.href = '/home';
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('返回home页面失败:', error);
|
|
|
|
|
+ // 备用方案
|
|
|
|
|
+ router.replace('/home');
|
|
|
|
|
+ window.location.reload();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
const laboratoryList = ref([
|
|
const laboratoryList = ref([
|
|
|
{
|
|
{
|
|
@@ -82,8 +90,17 @@ const laboratoryList = ref([
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
const handleLabClick = (item) => {
|
|
const handleLabClick = (item) => {
|
|
|
- if (item.name === '智能台灯') {
|
|
|
|
|
- router.push('/blockly')
|
|
|
|
|
|
|
+if (item.name === '智能台灯') {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 立即修改URL,不经过Vue Router的队列处理
|
|
|
|
|
+ window.location.href = '/blockly';
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('直接跳转失败:', error);
|
|
|
|
|
+ // 备用方案:强制Vue Router进行跳转
|
|
|
|
|
+ router.replace('/blockly');
|
|
|
|
|
+ // 强制刷新页面以确保视图更新
|
|
|
|
|
+ window.location.reload();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|