0.2.7 • Published 1 year ago

vuecom-demo v0.2.7

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

vuecom-demo

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Lints and fixes files

npm run lint

Customize configuration

See Configuration Reference.

创建自定义npm包步骤

1.切换npm源

#查看当前源地址
npm config get registry
#切换源地址命令如下
npm config set registry=http://10.18.88.108:4873/

2.添加用户

#添加用户
npm adduser 
#登录
npm login
#查看当前登录用户
npm whoami

3.修改package.json
	"name": "test-comp",
	"version": "0.1.1",
	"private": false,
	"description": "测试组件",
	"main": "lib/test-comp.umd.min.js",
	"keywords": ["test-comp"],
	"author": { "name": "hahha" },
	"scripts": {
		"serve": "vue-cli-service serve",
		"build": "vue-cli-service build",
		"lib": "vue-cli-service build --dest lib packages/index.js"
	 }
4.添加packages文件夹
	//添加index.js
	
	// 其中引用组件
	import list from '../src/components/list.vue'
	
	const components = [
	    list
	]
	// 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
	const install = Vue => {
	    // 判断是否可以安装
	    if (install.installed) return
	        // 遍历注册全局组件
	    components.map(component => Vue.component(component.name, component))
	}
	// 判断是否是直接引入文件
	if (typeof window !== 'undefined' && window.Vue) {
	    install(window.Vue)
	}
	export default {
	    // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
	    install,
	    // 以下是具体的组件列表
	    list
	}
4.打包发布
npm run lib
npm publish
0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago