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

HMR <script setup> change template, output Cannot read property 'style' of null in used v-for #613

Closed
baihuibo opened this issue Jul 23, 2020 · 0 comments · Fixed by vuejs/core#1707

Comments

@baihuibo
Copy link

baihuibo commented Jul 23, 2020

Describe the bug

Using 'v-for' in the template comes from the ref object. When changing the template,

the console output error Cannot read property 'style' of null

strange:If you remove the @submit event or style just fine

Reproduction

app.vue

<template>
    <form @submit="" style="margin-top: 20px;"></form>

    <ul>
        <li v-for="item in objRef.list">
            {{item}}
        </li>
    </ul>

   <!-- Just change the template here -->

    <demo ref="objRef"/>
</template>

<script setup>
    import {ref} from 'vue';
    import demo from "./demo.vue";

    export default {
        components: {demo}
    }
    export const objRef = ref({});
</script>

demo.vue

<template>
    <h1>demo comp</h1>
</template>

<script setup>
    export default {
        props: ['msg'],
    }
    export const list = ['a', 'b', 'c'];
</script>

微信截图_20200723210435

System Info

  • required vite version: 1.0.0-rc.3
  • required Operating System: windows 10
  • required Node version: v12.16.1
  • Optional:
    • npm/yarn version
    • Installed vue version (from yarn.lock or package-lock.json)
    • Installed @vue/compiler-sfc version 3.0.0-rc.4
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant