auto-vue-file
auto create .vue file by shell command
通过终端自动创建vue文件
前言:
1: 我们在写xxx.vue页面文件的时候,一般都要写这些重复的代码:
<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组件
// 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
结果
这样在components目录下面生成myForm文件
参数说明:
更多:
你也可以使用自己的vue模版文件,文件名为auto-vue-file.template.js,存放在项目根目录下面,内容如下
// 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}`} }
你也可以执行
auto-vue-file --init
自动生成该配置文件:auto-vue-file.template.js
然后改成你自己需要的样子。
总结
以上所述是小编给大家介绍的uto-vue-file:一个自动创建vue组件的包,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。