tmdhhl

mui

hbuilder连接夜神模拟器

mui相关

# 每个页面必须有
mui.plusReady(function() {
		});

  • 监听事件
document.getElementById(\'index\').addEventListener(\'tap\',function () {
	// 开一个新页面
	mui.openWindow({
		url: \'index.html\',
		id: \'index\',
		style: {
			top: \'0\',
			bottom: \'50px\',
		},
		extras: {

		},
		createNew:false,
	});
});


// 新页面接收extras参数
mui.plusReady(function() {
			var data = plus.webview.currentWebview();
		})
  • mui.fire(webview, \'event\', {data:data})
document.getElementById(\'send_music\').addEventListener(\'tap\',function () {
	var index = plus.webview.getWebviewById("HBuilder");
    mui.fire(index,"send_music",{"to_usr":"toy123","music":window.audio_srv + data.src})
    })

document.addEventListener("send_music", function(data) {
	ws.send(JSON.stringify(data.detail));
	})
  • mui.back() = function(){};

Storage

相当于web端的cookie

  • window.localStorage.setItem("key", data)
  • window.localStorage.getItem(\'key\')
  • window.localStorage.removeItem(\'key\')

加载子页面

  • subpages

播放音频

# 创建player对象
player = plus.audio.createPlayer(window.audio_srv + data.src);                                                          

# 重头开始播放
player.play();

# 暂停播放
player.pause()

# 继续播放
player.resume()

# 停止播放
player.stop()

分类:

技术点:

相关文章:

  • 2021-11-11
  • 2021-11-22
  • 2021-12-02
  • 2021-05-12
  • 2021-05-10
  • 2021-12-18
  • 2021-06-29
猜你喜欢
  • 2021-12-12
  • 2021-07-09
  • 2021-07-14
  • 2022-12-23
  • 2021-11-30
  • 2021-11-28
相关资源
相似解决方案