vscode写debugger无效 / 谷歌F12想network接口和console一起出现

本文讲述了在VSCode中使用debugger遇到问题时,如何在Vue.config.js中添加sourcemap配置以启用调试。同时介绍了在谷歌浏览器中快速打开并同步Network和Console的方法,包括使用Esc键和右上角菜单操作。

vscode写debugger无效

在项目里,想用debugger打断点调试,发现不生效

vue.config.js文件中,搜索configureWebpack,在里面加 devtool:"source map",

重新运行项目,就可以用debugger了

谷歌浏览器F12接口和console一起出现

F12调出调试工具后,想要这种效果

Network和Console一起出现

方法一:点Esc,就出现了

方法二:右上角三个点,选择More tools,然后随便选一个就可以了

想要的效果

<template> <div class="container"> <div class="preview-content" v-if="fileLink"> <iframe :src="fileLink" frameborder="0" class="preview-content-iframe"></iframe> </div> <div class="error-message" v-else> 文件评审链接加载失败,请检查网络或数据。 </div> </div> </template> <script> import { ref, onMounted } from 'vue' import { useRoute } from 'vue-router' import axios from 'axios' export default { setup() { const route = useRoute() const fileLink = ref(null) const fetchPreviewLink = async () => { try { const tableId = route.query.TableId if (!tableId) { console.warn('缺少参数 TableId') return } debugger // 获取文件信息 const fileRes = await axios.get('/api/Flow_Task/getFile', { params: { TableId: tableId } }) const fileData = fileRes.data debugger if (!fileData) { console.warn('未找到文件信息') return } const flowInstanceID = fileData.Id console(flowInstanceID) debugger // 获取流程ID const flowIdRes = await axios.get('/api/Flow_Task/getFlowID', { params: { flowInstanceID } }) const sFlowID = flowIdRes.data.flowID debugger if (sFlowID === 'fileBatchFlow') { const encodedReviewId = encodeURIComponent(flowInstanceID) const targetUrl = `/#/Drawings_Online_Approval_A?reviewId=${encodedReviewId}` fileLink.value = targetUrl window.open(targetUrl, '_blank') } else { // 获取当前用户工号 const workNumRes = await axios.post('/api/Review_Info/getCurrentUserWorkNum') const sWorkNum = workNumRes.data.sWorkNum // 构造跳转 URL const sFileCode = encodeURIComponent(fileData.FileCode) const sReviewVersion = encodeURIComponent(fileData.FileVersion) const targetUrl = `http://10.9.38.83:5773/#/document-review?sFileCode=${sFileCode}&sWorkNum=${encodeURIComponent( sWorkNum )}&sReviewVersion=${sReviewVersion}` fileLink.value = targetUrl window.open(targetUrl, '_blank') } } catch (error) { console.error('处理跳转逻辑失败:', error) alert('处理跳转逻辑失败,请查看控制台日志') } } onMounted(() => { fetchPreviewLink() }) return { fileLink } } } </script> <style lang="less" scoped> .container { display: flex; width: 100%; height: 100%; flex-direction: row; flex-wrap: wrap; border-right: 1px solid rgb(182, 197, 240); border-bottom: 1px solid rgb(182, 197, 240); .error-message { font-size: 24px; color: #d90000; text-align: center; padding: 20px; width: 100%; height: 100%; } .preview-content { width: 100%; height: 100%; margin-top: 5px; border: 1px solid #dfeafc; .preview-content-iframe { width: 100%; height: 100%; } } } </style> 我这个的有问题吗?为啥 const fileRes = await axios.get('/api/Flow_Task/getFile', { params: { TableId: tableId } }) 这个走完没走到下个debugger
10-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值