const src = ""; // 本地某gif图片路径
const res = uni.getSystemInfoSync();
const clientWidth = res.windowWidth
const clientHeight = res.windowHeight
const tags: PlusNativeObjViewDrawTagStyles[] = [
{ tag: 'img', id: 'img', src: src as string }
];
var view = new plus.nativeObj.View('yspc',
{ left: (clientWidth - 70) + 'px', top: (clientHeight - 66) + 'px', height: '66px', width: '66px' },
tags
);
view.show();
let startOffsetX = 0;
let startOffsetY = 0;
view.addEventListener("touchstart", function (event) {
startOffsetX = event.clientX;
startOffsetY = event.clientY;
});
view.addEventListener("touchmove", function (event) {
const { screenX, screenY } = event;
view.setStyle({
left: screenX - startOffsetX + 'px',
top: screenY - startOffsetY + 'px',
});
}, false);
1 个回复
zhrey
我也遇到这个问题了,有解决方案没?