jsは文字列内の数字の色を変更します

まず、この文字列を配列に変換します

let str = '292f29c7268d395c166295d93be532de1338401624c70b7d7211e82f6cdd976c'

let list=[]

list = str.split('')

そしてラベルがループ表示されたら判定する

<div
  v-for="(item, index) in list"
  :key="index"
  :style="{
  color: /^[0-9]+.?[0-9]*/.test(item) == true ? 'red' : '',
  fontWeight: /^[0-9]+.?[0-9]*/.test(item) == true ? '800' : '',
  }">
     {
   
   { item }}
</div>

ここでは正規表現を使用しています

おすすめ

転載: blog.csdn.net/m0_61672533/article/details/128375282
おすすめ