欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

學(xué)習(xí)Vim合并行的方法和技巧

 更新時(shí)間:2017年11月27日 11:33:35   投稿:laozhang  
這篇文章主要介紹了學(xué)習(xí)Vim合并行的方法以及代碼實(shí)現(xiàn)過(guò)程,值得參考,一起來(lái)學(xué)習(xí)下。

剛接觸 Vim 會(huì)覺(jué)得它的學(xué)習(xí)曲線非常陡峭,要記住很多命令。所以這個(gè)系列的分享,不會(huì)
教你怎么配置它,而是教你怎么快速的使用它。

在開(kāi)發(fā)時(shí)為了代碼美觀,經(jīng)常會(huì)把屬性用換行的方式顯示。

<el-dialog 
 title="批量編輯所屬組織" 
 :visible.sync="isShow" 
 :before-close="beforeClose"
 >
...
</el-dialog>

這種場(chǎng)景適用于標(biāo)簽屬性少,代碼量也少的情況。

如果標(biāo)簽突然增多,閱讀起來(lái)就會(huì)很不方便。比如下面這樣:

<template>
 <el-table
 :data="tableData"
 border
 style="width: 100%">
 <el-table-column
  fixed
  prop="date"
  label="日期"
  width="150">
 </el-table-column>
 <el-table-column
  prop="name"
  label="姓名"
  width="120">
 </el-table-column>
 <el-table-column
  prop="province"
  label="省份"
  width="120">
 </el-table-column>
 <el-table-column
  prop="city"
  label="市區(qū)"
  width="120">
 </el-table-column>
 <el-table-column
  prop="address"
  label="地址"
  width="300">
 </el-table-column>
 <el-table-column
  prop="zip"
  label="郵編"
  width="120">
 </el-table-column>
 <el-table-column
  fixed="right"
  label="操作"
  width="100">
  <template scope="scope">
  <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
  <el-button type="text" size="small">編輯</el-button>
  </template>
 </el-table-column>
 </el-table>
</template>

所以我們就需要把標(biāo)簽和屬性變?yōu)橐恍小?/p>

<template>
 <el-table :data="tableData" border style="width: 100%">
 <el-table-column fixed prop="date" label="日期" width="150"> </el-table-column>
 <el-table-column prop="name" label="姓名" width="120"> </el-table-column>
 <el-table-column prop="province" label="省份" width="120"> </el-table-column> 
 <el-table-column prop="city" label="市區(qū)" width="120"> </el-table-column>
 <el-table-column prop="address" label="地址" width="300"> </el-table-column>
 <el-table-column prop="zip" label="郵編" width="120"> </el-table-column>
 <el-table-column fixed="right" label="操作" width="100">
  <template scope="scope">
  <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
  <el-button type="text" size="small">編輯</el-button>
  </template>
 </el-table-column>
 </el-table>
</template>

多數(shù) IDE 在代碼格式化時(shí),都不會(huì)處理標(biāo)簽的屬性。

我們只能通過(guò)光標(biāo)換行,然后在按刪除的方式進(jìn)行解決。

那么接下來(lái)介紹的這個(gè)技巧,叫 “合并行”,能讓我們快速的解決這個(gè)問(wèn)題。

其實(shí)我們可以看出來(lái),這個(gè)VIM合并行,就好比是代碼格式化一樣的,讓寫(xiě)出的代碼更加容易讀,格式更加好看,如果大家還有其他問(wèn)題,可以在下面留言區(qū)討論。

相關(guān)文章

最新評(píng)論