vscode编辑器保存后,出现了意外的修改

可能性1:
.vscode/settings.json中editor.formatOnSave被置为了true,改为false即可

可能性2:
编辑器启用了EditorConfig
将EditorConfig禁用或者修改项目根目录中的.editorconfig,修改其中的配置项以关闭某些自动修改

npm install安装失败情况记录

npm WARN deprecated is-accessor-descriptor@0.1.6: Please upgrade to v0.1.7
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'D:\\workspace\\video-react\\node_modules\\@babel',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'D:\workspace\video-react\node_modules\@babel\preset-env\node_modules'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'D:\\workspace\\video-react\\node_modules\\@babel\\preset-env\\node_modules'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/yup/-/yup-0.27.0.tgz failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in: C:\Users\refanbanzhang\AppData\Local\npm-cache\_logs\2024-11-05T22_37_44_642Z-debug-0.log

当前电脑环境与https://registry.npmjs.org连结有问题,尝试修改项目根目录下的.npmrc,重新npm install安装成功。

// .npmrc

registry=https://registry.npmmirror.com

这个问题原因是本地代码仓库的npm源设置覆盖了用户npm源设置

在组件中调用emit('refresh')自定义事件,父组件始终监听不到触发

<Popup :visible="popupVisible">
    <Son @refresh="onRefresh" />
</Popup>

const onRefresh = () => {
    console.log('refresh')
}

最后排查出来的原因是:由于Son组件调用emit('refresh')时,子组件已经被销毁了,所以在父组件中就无法监听到refresh事件的触发。

更新时操作时,忘记考虑已存在的数据,引入了bug

如下场景,我想更新url,但是却忘了url上有其他参数,没有在更新时保留,导致引入了bug。

错误示例:

  router.replace({
    name: 'preview',
    query: {
      filePath: nextFilePath,
    },
  })

修正示例:

  router.replace({
    name: 'preview',
    query: {
      ...existQuery,
      filePath: nextFilePath,
    },
  })

热饭班长
3.7k 声望434 粉丝

先去做,做出一坨狗屎,再改进。