我在 vscode 中遇到了一個奇怪的錯誤......我正在用 react.js 創建一個應用程式。當我在 js 檔案中撰寫代碼時,標簽撰寫正確,但是當我保存代碼更改的格式時,我在運行時遇到了這個錯誤...例如我寫這個代碼:
const renderForeigner = (foreigner) => {
if (foreigner) {
return <CFormGroup row >
<CCol xs = "12" md = "3" >
<CSelect custom name = "IDBirthPlace" id = "IDBirthPlace" >
{ /* <option value="0">Please select</option> */ }
<option value = "0" > country</option>
</CSelect >
</CCol >
<CCol xs = "12" md = "4" >
<CInput type = "number" id = "CertificateNo" name = "CertificateNo" autoComplete = "off" />
</CCol> <CCol xs = "12" md = "2" >
<DatePicker
value = { passExpireDate }
onChange = { setPassExpireDate }
inputPlaceholder = "expiration date"
shouldHighlightWeekends
locale = "fa"
/>
</CCol>
</CFormGroup >
}
當我保存我的代碼更改時:
const renderForeigner = (foreigner) => {
if (foreigner) {
return <CFormGroup row >
<
CCol xs = "12"
md = "3" >
<
CSelect custom name = "IDBirthPlace"
id = "IDBirthPlace" > { /* <option value="0">Please select</option> */ } <
option value = "0" > country< /option> <
/CSelect > <
/CCol > <
CCol xs = "12"
md = "4" >
<
CInput type = "number"
id = "CertificateNo"
name = "CertificateNo"
autoComplete = "off" / >
<
/CCol> <CCol xs = "12" md = "2" > <
DatePicker
value = { passExpireDate }
onChange = { setPassExpireDate }
inputPlaceholder = "expiration date"
shouldHighlightWeekends
locale = "fa" /
>
<
/CCol> <
/CFormGroup >
}
````
I don't know what snippet makes these changes or what snippet should I install to solve this problem?
uj5u.com熱心網友回復:
VS Code 提供格式保存功能。如果您禁用該功能,您的代碼將不會更改。
解決方法是按 Ctrl Shift P 并搜索“打開設定 UI”。在打開的設定 UI 搜索“保存格式”中,現在您只需取消選中該復選框,您的問題就會解決。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/381998.html
標籤:javascript html 反应 视觉工作室代码
