欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

vue中auto-vue-file包有什么用

這篇文章主要介紹vue中auto-vue-file包有什么用,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!

創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供廣信網(wǎng)站建設(shè)、廣信做網(wǎng)站、廣信網(wǎng)站設(shè)計、廣信網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、廣信企業(yè)網(wǎng)站模板建站服務(wù),10多年廣信做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。

auto-vue-file

auto create .vue file by shell command

通過終端自動創(chuàng)建vue文件

前言:

1: 我們在寫xxx.vue頁面文件的時候,一般都要寫這些重復(fù)的代碼:

<template>
 <div class="zlj-comp-ct">
 zlj組件
 </div>
</template>
<script>
export default {
 name: 'zlj'
}
</script>
<style lang="scss" scoped>
.zlj-comp-ct {

}
</style>

2:寫組件的時候可能還要在components目錄下面新建一個目錄:xxx,里面是xxx.vue和index.js

比如myForm組件

vue中auto-vue-file包有什么用

// myForm.vue
<template>
 <div class="myForm-comp-ct">
 myForm組件
 </div>
</template>
<script>
export default {
 name: 'myForm'
}
</script>
<style lang="scss" scoped>
.myForm-comp-ct {

}
</style>
// index.js
import myForm from './myForm.vue'
export default myForm

每次都寫這些代碼,是不是很煩?

主角登場:auto-vue-file

安裝

npm install auto-vue-file -g

使用

 auto-vue-file -c

結(jié)果

vue中auto-vue-file包有什么用

這樣在components目錄下面生成myForm文件

參數(shù)說明:

名稱說明使用例子
component創(chuàng)建一個vue組件, 默認(rèn)在components目錄下面auto-vue-file -c 或 auto-vue-file --component
page創(chuàng)建一個vue組件,默認(rèn)在views目錄auto-vue-file -p 或 auto-vue-file --page
path在指定目錄創(chuàng)建vue組件,需要提供-c或-p參數(shù)auto-vue-file -c --path ./src/haha 或 auto-vue-file -p --path ./src/haha

更多:

你也可以使用自己的vue模版文件,文件名為auto-vue-file.template.js,存放在項目根目錄下面,內(nèi)容如下

// template.js you can generate
// auto-vue-file.template.js
  module.exports = {
   vueTemplate: componentName => {
   return `<template>
   <div class="${componentName}-comp-ct">
   ${componentName}組件
   </div>
  </template>
  <script>
  export default {
   name: '${componentName}'
  }
  </script>
  <style lang="scss" scoped>
  .${componentName}-comp-ct {
  
  }
  </style>
  `
   },
   entryTemplate: componentName => {
   return `import ${componentName} from './${componentName}.vue'
  export default ${componentName}`}
  }

你也可以執(zhí)行

auto-vue-file --init

自動生成該配置文件:auto-vue-file.template.js

然后改成你自己需要的樣子。

以上是“vue中auto-vue-file包有什么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

新聞標(biāo)題:vue中auto-vue-file包有什么用
文章出自:http://chinadenli.net/article30/gsgipo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作微信公眾號、關(guān)鍵詞優(yōu)化、ChatGPT網(wǎng)站導(dǎo)航、網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名