In Vue, if you want to pop something up on a page, the usual way is:

  1. Write what you want to pop up on the page beforehand and hide it with visible: False
  2. Controls Visible to show or hide again

This is what I used in the last mobile project, where the component has its own animation and controls the component to show and hide

The other way is

  1. A Vue instance is created when the user clicks the button
  2. The Vue instance is deleted when the user clicks another button

Element UI’s $message is implemented this way, and is particularly suited to the notification class scenario, as shown below.

I’ve never used this before

Today saw fangfang, learned: zhuanlan.zhihu.com/p/38076208