README
default
package.json
// 配置main结点,如果不配置,我们在其他项目中就不用import XX from '包名'来引用了,只能以包名作为起点来指定相对的路径
"main": "dist/helloWorld.js",
// 因为组件包是公用的,所以private为false
"private": false,
//npm 发布配置地址
"publishConfig" : {
"registry" : "http://maven.xiaotitong.com/nexus/repository/fe-npm/"
},
http://maven.xiaotitong.com/nexus/repository/npm-group/
npm set registry安装依赖包npm install
发布项目到私有仓库 npm publish
使用组件
1引入依赖
"dependencies": {
"core-js": "^2.6.5",
"vue": "^2.6.10",
"xtt-hello-world": "1.0.2" //引入
},
2页面上使用
<template>
<div id="app">
<!-- <img alt="Vue logo" src="./assets/logo.png">-->
<HelloWorld msg="Welcome to Demo"/> //3使用组件
</div>
</template>
<script>
import HelloWorld from 'xtt-hello-world' //1导入
export default {
name: 'app',
components: {
HelloWorld // 2 使用
}
}
</script>