Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] v-if 嵌套时执行逻辑错误 #33

Closed
elcarim5efil opened this issue Nov 16, 2018 · 0 comments
Closed

[BUG] v-if 嵌套时执行逻辑错误 #33

elcarim5efil opened this issue Nov 16, 2018 · 0 comments
Labels
bug Something isn't working

Comments

@elcarim5efil
Copy link
Member

代码:

<template>
  <div>
    <div v-if="obj">
      <div v-if="obj.a"></div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      obj: null
    }
  }
}
</script>

现象:

报错 Cannot read property 'a' of undefined;

原因:

第一个调整判断为 false 时,后面的条件判断不应该执行,但是在 render 方法里没有对 v-if 嵌套关系进行判断。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant