提交 b26dad14 编写于 作者: A Anne_LXM

调整Element为UniElement

上级 b79f7328
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
export default { export default {
data() { data() {
return { return {
$elementMap: new Map<string, Element>(), $elementMap: new Map<string, UniElement>(),
x: 0 as number, x: 0 as number,
y: 0 as number, y: 0 as number,
// 飘走的卡片计数 // 飘走的卡片计数
...@@ -88,7 +88,7 @@ ...@@ -88,7 +88,7 @@
} else { } else {
// console.log('直接拿'); // console.log('直接拿');
} }
element?.style?.setProperty(propertyName, propertyStyle); element.style.setProperty(propertyName, propertyStyle);
}, },
touchstart(e : TouchEvent) { touchstart(e : TouchEvent) {
// console.log('touchstart') // console.log('touchstart')
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
export default { export default {
data() { data() {
return { return {
$elementMap: new Map<string, Element>() $elementMap: new Map<string, UniElement>()
} }
}, },
methods: { methods: {
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
}, },
// 工具方法,用于快速设置 Element 的 style // 工具方法,用于快速设置 Element 的 style
setElementStyle(refName : string, propertyName : string, propertyStyle : any) : void { setElementStyle(refName : string, propertyName : string, propertyStyle : any) : void {
let element : Element | null = (this.$data['$elementMap'] as Map<string, Element>).get(refName) let element : UniElement | null = (this.$data['$elementMap'] as Map<string, UniElement>).get(refName)
if (element == null) { if (element == null) {
element = this.$refs[refName] as UniElement; element = this.$refs[refName] as UniElement;
(this.$data['$elementMap'] as Map<string, Element>).set(refName, element) (this.$data['$elementMap'] as Map<string, UniElement>).set(refName, element)
} }
element.style.setProperty(propertyName, propertyStyle); element.style.setProperty(propertyName, propertyStyle);
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册