步骤
创建 vue 的脚手架
npm install -g @vue/clivue init webpack
绑定 git 项目
cd existing_foldergit initgit remote add origin http://gitlab.alipay-inc.com/ampg/my-projec.gitgit add .git commitgit push -u origin master
写组件
创建组件 src/components/xxx.vue
例如:
<template> <div class="hello"> <h1>{{ msg }}</h1> <h2>Essential Links</h2> </div></template><script>export default { name: 'HelloWorld', data () { return { msg: 'Welcome to Your Vue.js App' } }}</script><!-- Add "scoped" attribute to limit CSS to this component only --><style scoped>h1, h2 { font-weight: normal;}</style>
发布
npm publish
展示
参考文档
Packaging Vue Components for npm
Vue CLI 3
vue-sfc-rollup
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持武林网。
新闻热点
疑难解答