栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

插值不反映Angular应用中的最新值

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

插值不反映Angular应用中的最新值

发生这种情况是因为

move()
仅当将块从 Gray区域之外移动时才调用your,但是
draw()
所有鼠标移动都调用了your 。

currentBox
选择并移动位置时,您需要更新位置。

  draw() {    const movingBlockIndex = (this.dropzone1.indexOf(this.currentBox));    if (movingBlockIndex > -1) {      this.will_draw = false;      const { width, height } = this.parentparent.nativeElement.getBoundingClientRect();      const perc_x = this.mouse.x / width * 100;      const perc_y = this.mouse.y / height * 100;      // -5 to center (elem has its width set to 10%)      // console.log('left', (perc_x - 5) + '%');      this.left = perc_x - 5;      this.topLeft = []      this.topLeft.push(this.left);      // -5 to center (elem has its height set to 10%)      // console.log('top', (perc_y - 5) + '%');      this.top = perc_y - 5;      this.topLeft.push(this.top)      this.dropzone1[movingBlockIndex].pos[0] = (perc_x - 5);      this.dropzone1[movingBlockIndex].pos[1] = (perc_y - 5);    }  }


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/635187.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号