Lucas7
Lucas7
  • 发布:2024-07-16 15:02
  • 更新:2025-02-12 11:31
  • 阅读:134

#插件讨论# 【 环形颜色选择器 - kepa 】微信小程序中显示问题

分类:uni-app
关联插件: 环形颜色选择器

程序从HBuider IDE中运行到微信开发者工具中后,取色点拖动没反应。
微信开发者工具中报错:
vendor.js?t=wechat&s=1721112468022&v=2d834e082f2f1adffd5d64aff7b82c50:3313 Maximum recursive updates exceeded in component <color-slider>. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.(env: Windows,mp,1.06.2405020; lib: development)、
在HBuider IDE中的web浏览器内取色点能拖动,但当前显示颜色没变化。


环境:WIN11 x64, HBuilder 4.23,微信开发者工具 Stable 1.06.2405020

2024-07-16 15:02 负责人:无 分享
已邀请:
q***@163.com

q***@163.com

我这边解决的办法是,初始化位置时需要加500ms延迟不然获取的位置不正确,然后赋值时位置时不要结构

const init = () => {  
    let _this = getCurrentInstance()  
    setTimeout(async ()=>{  
        const query = uni.createSelectorQuery().in(_this)  
        // // #ifdef MP  

        // const query = uni.createSelectorQuery().in(_this)  
        // // #endif  
        // // #ifndef MP  
        // const query = uni.createSelectorQuery()  
        // // #endif  
        query.select('.arc-circle').boundingClientRect((res: any) => {  
          const { top, left } = res  
          arcOffset.value = { top, left }  
        }).exec()  
        await calcDotPosition(calcRatio(color))  
    },500)  

}
const calcDotPosition = (angleA: number) => {  
  const cosA = Math.cos(angleA * 2 * Math.PI / 360),  
    sinA = Math.sin(angleA * 2 * Math.PI / 360),  
    x = Math.floor((O.x - A.x) * cosA - (O.y - A.y) * sinA + A.x),  
    y = Math.floor((O.y - A.y) * cosA + (O.x - A.x) * sinA + A.y);  
    console.log(x,y)  
    dotPosition.value.x = x  
    dotPosition.value.y = y  
  // dotPosition.value = { x, y }  
}

要回复问题请先登录注册