PanJiaChen / vue-element-admin

:tada: A magical vue admin https://panjiachen.github.io/vue-element-admin
MIT License
87.98k stars 30.47k forks source link

Reomve RightPanel issue in IE11 #2274

Open moonose opened 5 years ago

moonose commented 5 years ago

Bug report(问题描述)

First I disabled rightpanel. Then I enabled rightpanel for one page.

<template>
  <div>
    <main-panel />
       <right-panel :maxWidth="700">
             <other-panel />
       </right-panel>
  </div>
</template>
<script>
 import RightPanel from '@/components/RightPanel'
 import mainPanel from './main'
 import otherPanel from './others'

When I switch to the other pages without rightpanel, it will prompt a Vue warn in IE11. (Running in Chrome is ok)

 [Vue warn]: Error in beforeDestroy hook: "TypeError: Object doesn't support property or method 'remove'"
 ...
 description"Object doesn't support property or method 'remove'"

I find it is caused by below code.

  beforeDestroy() {
     const elx = this.$refs.rightPanel
     elx.remove()
  },

elx.remove() this method throw the warning.

Other relevant information(格外信息)

moonose commented 5 years ago

这样改能纠正IE 不能用 remove() 方法的问题

try{
  elx.remove() 
} catch {
  elx.removeNode(true)
}