1.0.7 • Published 9 months ago

@df_business/tools-nj v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

nodeJS工具包

简介

测试

npm run test

发布

publish.bat

使用

# 安装
npm i @df_business/tools-nj --save
# 更新
npm update @df_business/tools-nj
# 移除
npm r @df_business/tools-nj

ws

main.js

let df_tools = require('@df_business/tools-nj');
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

let df_tools = require('@df_business/tools-nj');
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.7

9 months ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago