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 Report] Use vue router and Form slot in a Popover will trigger an error. #1713

Closed
microkof opened this issue Mar 29, 2021 · 6 comments
Closed
Labels
🔨 Vue issue Issue caused by Vue. Can't do anything

Comments

@microkof
Copy link

Element Plus version

1.0.2-beta.36

OS/Browsers version

Windows 10 / Chrome 74

Vue version

3.0.9

Reproduction Link

https://codepen.io/iamkun/pen/YzXMaVr

Steps to reproduce

I can't use codepen at all, but I still want to mention bugs, so the link above is wrong, but I can provide a preview url,

http://hebeieditor.sinaapp.com/#/

I have created two pages, one of which is written casually, and the other is written in these codes. The key point is that Popover packages the form, and there must be <el-form-item> in Form.

<template>
    <el-popover placement="right" :width="400" trigger="click">
      <template #reference>
        <el-button>click 激活</el-button>
      </template>
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="审批人">
          <el-input v-model="formInline.user" placeholder="审批人"></el-input>
        </el-form-item>
      </el-form>
    </el-popover>
</template>

<script>
import { reactive } from "vue";
export default {
  setup() {
    let formInline = reactive({});
    function onSubmit() {
      console.log(111);
    }
    return {
      formInline,
      onSubmit,
    };
  },
};
</script>

Use the route function to switch 2 pages. When the page above leaves the route, an error will be reported.

What is Expected?

I hope I can use Popover embedded form normally.

What is actually happening?

I Can't.

@element-bot
Copy link
Member

Translation of this issue:

Element Plus version

1.0.2-beta.36

OS/Browsers version

Windows 10 / Chrome 74

Vue version

3.0.9

Reproduction Link

https://codepen.io/iamkun/pen/YzXMaVr

Steps to reproduce

I can't use codepen at all, but I still want to mention bugs, so the link above is wrong, but I can provide a preview url,

http://hebeieditor.sinaapp.com/#/
I have created two pages, one of which is written casually, and the other is written in these codes. The key point is that Popover packages the form, and there must be <el-form-item> in Form.

<template>

<el-popover placement=\"right\" :width=\"400\" trigger=\"click\">
<template #reference>

< El button > Click to activate < / El button >
</template>

<el-form :inline=\"true\" :model=\"formInline\" class=\"demo-form-inline\">
< El form item label = \"approved by\" >

<el-input v-model=\" formInline.user \"Placeholder =\" Examiner \"> < / El input >
</el-form-item>

</el-form>
</el-popover>

</template>
<script>

import { reactive } from \"vue\";
export default {

setup() {
let formInline = reactive({});

function onSubmit() {
console.log (111);

}
return {

formInline,
onSubmit,

};
},

};
</script>

Use the route function to switch 2 pages. When the page above leaves the route, an error will be reported.

What is Expected?

I hope I can use Popover embedded form normally.

What is actually happening?

I Can't.

@inottn
Copy link
Contributor

inottn commented Mar 30, 2021

It is a vue`s bug. vuejs/vue-next#3497

@jw-foss
Copy link
Member

jw-foss commented Mar 31, 2021

You might want to use codesandbox that we have a link on the front page, click that icon you can jump right into the template we made before, fork it then you can have your own code sample.

@jw-foss
Copy link
Member

jw-foss commented Mar 31, 2021

According to the issue vuejs/core#3497, it seems they had already fixed this, you need to upgrade your version to 3.0.10 to fix this issue.

@jw-foss jw-foss added the 🔨 Vue issue Issue caused by Vue. Can't do anything label Mar 31, 2021
@jw-foss
Copy link
Member

jw-foss commented Mar 31, 2021

I read through the issue description, the root cause of this issue is that they somehow unmounted teleport's children more than once, since ElPopover is implemented with teleport feature, so this issue should be a bug from vue.

@jw-foss
Copy link
Member

jw-foss commented Mar 31, 2021

I will close this issue since it has been fixed by vue, if you have further issue on this, feel free to reopen it.

@jw-foss jw-foss closed this as completed Mar 31, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 Vue issue Issue caused by Vue. Can't do anything
Projects
None yet
Development

No branches or pull requests

4 participants