使用WebStrom 写weex vue代码时,解决code formate导致 text控件换行的问题,比如以下代码
<text v-for="(item, m) in cell.items" :ref="'ref_top_'+k+'_'+m":style="[{fontSize:10,marginLeft:5,backgroundColor:(cell.index===m)?'#ff6956':((pos_top===k&&focusTop&&cell.index_temp===m)?'#ffdd6f':'#00000000'),
color:(pos_top===k&&focusTop&&cell.index===m)?'#000':'#fff'}]">{{item.name}}</text>
在code formate后,最后一行
>{{item.name}}</text>
会自动换行为
>{{item.name}}
</text>
这样会导致weex页面渲染出现异常问题,正确的解决方案如下:
打开idea: webstorm——preferences——Editor——code style——HTML——Other——Don't break if inline content:
在最后加入 text,最后apply——ok即可。