+
80
-

uniapp开发的app如何拉起手机内置的系统分享?

uniapp开发的app如何拉起手机内置的系统分享?


网友回复

+
0
-
methods: {
			sharesys() {
				var msg = {
					content: "测试:",
					href: "https://bfw.wiki"
				};
				plus.share.sendWithSystem ? plus.share.sendWithSystem(msg, function() {
					console.log('Success');
				}, function(e) {
					console.log('Failed: ' + JSON.stringify(e));
				}) : this.shareSystemNativeJS();
			},

			shareSystemNativeJS() {
				if (plus.os.name !== 'Android') {
					plus.nativeUI.alert('此平台暂不支持系统分享功能!');
					return;
				}
				var intent = new Intent(Intent.ACTION_SEND);
				intent.setType('text/plain');
				intent.putExtra(Intent.EXTRA_SUBJECT, 'Hello');
				intent.putExtra(Intent.EXTRA_TEXT, sharecontent.value);
				intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				main.startActivity(Intent.createChooser(intent, '系统分享Hello'));
			}

		}

我知道答案,我要回答