Vue元件頁面渲染 字段無法格式化

2021-10-11 13:55:42 字數 1052 閱讀 4153

錯誤場景

(下拉選框)服務狀態字段顯示為 數字0或1,執行格式化方法後無法生效.

解決

錯誤寫法value, servicestatus欄位目前還是varchar型別.

正確寫法:value, servicestatus欄位是int型別, 即可以正常格式化.

:span

="12"

>

label

="服務狀態"

prop

="servicestatus"

:formatter

="servicestatusformat"

>

disabled

v-model

="editdata.servicestatus"

placeholder

="請輸入服務狀態"

>

label

="關閉"

:value

="0"

/>

label

="正常"

:value

="1"

/>

el-select

>

el-form-item

>

el-col

>

// 格式化服務狀態

servicestatusformat

(row, column

)else

if(row.servicestatus ===1)

else

}

測試,成功!

資料庫中該字段的型別如果為int, 實體類中和前端頁面都必須為數值型別. 型別要統一.

vue路由巢狀無法渲染 頁面空白

router index.js import vue from vue import router from vue router import helloworld from components helloworld import login from components layout log...

vue動態渲染元件

component 動態渲染元件 使用來動態渲染元件 使用方式 mycomponent component keep alive vue.component briup success vue.component briup error newvue methods changeerror chan...

強制 Vue 重新渲染元件

有時候,依賴 vue 響應方式來更新資料是不夠的,相反,我們需要手動重新渲染元件來更新資料。或者,我們可能只想拋開當前的dom,重新開始。那麼,如何讓vue以正確的方式重新呈現元件呢?強制 vue 重新渲染元件的最佳方法是在元件上設定 key。當我們需要重新渲染元件時,只需更 key 的值,vue ...