Code Monkey home page Code Monkey logo

Comments (10)

ydaydayup avatar ydaydayup commented on May 29, 2024 2

我正在准备提一个pr,我先考虑下修改方案

from element-plus.

chenxch avatar chenxch commented on May 29, 2024

目前部分组件的zIndex都是初始化后固定的,或许可以考虑将其改为计算属性。

from element-plus.

chenxch avatar chenxch commented on May 29, 2024

我正在准备提一个pr,我先考虑下修改方案

可以参考部分组件已经实现的方案

from element-plus.

ydaydayup avatar ydaydayup commented on May 29, 2024
  // const zIndex = ref(props.zIndex ?? nextZIndex())   ---- 改前
  const zIndex = !isUndefined(props.zIndex)
    ? computed(() => props.zIndex)
    : ref(nextZIndex())

我在公司尝试改成如上,是可以解决问题的,具体pr今天下班回家提一个

from element-plus.

chenxch avatar chenxch commented on May 29, 2024
  // const zIndex = ref(props.zIndex ?? nextZIndex())   ---- 改前
  const zIndex = !isUndefined(props.zIndex)
    ? computed(() => props.zIndex)
    : ref(nextZIndex())

我在公司尝试改成如上,是可以解决问题的,具体pr今天下班回家提一个

这个写法是存在问题的,如果初始化zIndex是undefined,你后续怎么变更都是使用nextZIndex返回的值,完全可以用计算属性直接解决,建议参考tour组件中的处理方案。

from element-plus.

automan-bot avatar automan-bot commented on May 29, 2024
  // const zIndex = ref(props.zIndex ?? nextZIndex())   ---- 改前
  const zIndex = !isUndefined(props.zIndex)
    ? computed(() => props.zIndex)
    : ref(nextZIndex())

我在公司尝试改成如上,是可以解决问题的,具体pr今天下班回家提一个

这个写法是存在问题的,如果初始化zIndex是undefined,你后续怎么变更都是使用nextZIndex返回的值,完全可以用计算属性直接解决,建议参考tour组件中的处理方案。

确实是存在问题得

from element-plus.

ydaydayup avatar ydaydayup commented on May 29, 2024
  // const zIndex = ref(props.zIndex ?? nextZIndex())   ---- 改前
  const zIndex = !isUndefined(props.zIndex)
    ? computed(() => props.zIndex)
    : ref(nextZIndex())

我在公司尝试改成如上,是可以解决问题的,具体pr今天下班回家提一个

这个写法是存在问题的,如果初始化zIndex是undefined,你后续怎么变更都是使用nextZIndex返回的值,完全可以用计算属性直接解决,建议参考tour组件中的处理方案。

确实是存在问题得

OK,感谢,我再修改

from element-plus.

ydaydayup avatar ydaydayup commented on May 29, 2024
  // const zIndex = ref(props.zIndex ?? nextZIndex())   ---- 改前
  const zIndex = !isUndefined(props.zIndex)
    ? computed(() => props.zIndex)
    : ref(nextZIndex())

我在公司尝试改成如上,是可以解决问题的,具体pr今天下班回家提一个

这个写法是存在问题的,如果初始化zIndex是undefined,你后续怎么变更都是使用nextZIndex返回的值,完全可以用计算属性直接解决,建议参考tour组件中的处理方案。

pr构建报错,zIndex已经是计算属性了,我是否可以吧 zIndex.value = isUndefined(props.zIndex) ? nextZIndex() : zIndex.value++删除
fix(components): dialog zIndex 修改不生效

from element-plus.

zc-write-code avatar zc-write-code commented on May 29, 2024
  // const zIndex = ref(props.zIndex ?? nextZIndex())   ---- 改前
  const zIndex = !isUndefined(props.zIndex)
    ? computed(() => props.zIndex)
    : ref(nextZIndex())

我在公司尝试改成如上,是可以解决问题的,具体pr今天下班回家提一个

可不可以这样改: const zIndex = computed(() => props.zIndex ?? nextZIndex())

from element-plus.

ydaydayup avatar ydaydayup commented on May 29, 2024
  // const zIndex = ref(props.zIndex ?? nextZIndex())   ---- 改前
  const zIndex = !isUndefined(props.zIndex)
    ? computed(() => props.zIndex)
    : ref(nextZIndex())

我在公司尝试改成如上,是可以解决问题的,具体pr今天下班回家提一个

可不可以这样改: const zIndex = computed(() => props.zIndex ?? nextZIndex())

不可以,,会陷入 无限递归中,我一开始就这么改的

from element-plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.