1.0.10 • Published 2 years ago

dfer-tools-vue v1.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

npm工具包

简介

测试

node test.js

发布

<!-- 登录 -->
npm login

<!-- 设置版本 -->
<!-- 小变动,比如修复bug等,版本号变动 v1.0.0->v1.0.1 -->
npm version patch
<!-- 增加新功能,不影响现有功能,版本号变动 v1.0.0->v1.1.0 -->
npm version minor
<!-- 破坏模块对向后的兼容性,版本号变动 v1.0.0->v2.0.0 -->
npm version major

<!-- 发布 -->
npm publish

使用

<!-- 安装 -->
npm i dfer-tools-vue --save
<!-- 更新 -->
npm update dfer-tools-vue
<!-- 移除 -->
npm r dfer-tools-vue

ws

main.js

import df_tools from 'dfer-tools-vue';
Vue.prototype.$ws = df_tools.ws;

index.vue

<script>
	export default {	
	data() {
		return {
			host:'127.0.0.1:90'		
		}
	},
	created() {
		this.ws=this.$ws(this,{token:'asdfasdf'});
	},		
	methods: {
		onopen: function() {
			console.log("服务器连接成功",this.ws.state());
		},
		onmessage: function(e) {
			console.log(e);
		},
		onclose: function() {
			console.log();
		},
		onerror: function(e) {
			console.log();
		},
		send: function(data) {
			this.ws.send(data);				
		}
	}
	}
</script>

http

main.js

import df_tools from 'dfer-tools-vue';
Vue.prototype.$http = df_tools.http;

index.vue

<script>
	export default {
	methods: {	
		get: function(para) {
			this.$http.get('', para).then(function(data) {
				console.log(data);
			})		
		},
		post: function(para) {
			this.$http.post('', para).then(function(data) {
				console.log(data);
			})		
		}		
	}
	}
</script>
1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago