Element: [Bug Report] Notification is only introduced and not used, but there is always a blank Notification after the page is refreshed

Created on 5 Sep 2018  ·  4Comments  ·  Source: ElemeFE/element

Element UI version

2.4.6

OS/Browsers version

windows7/google版本 69.0.3497.81(正式版本) (64 位)

Vue version

2.5.2

Reproduction Link

https://jsfiddle.net/mmx38qxw/

Steps to reproduce

1、采用按需加载element-ui组件的步骤,在elemnet-ui/index.js里引入Notification组件:
import Vue from 'vue'
import {
Notification
} from 'element-ui'

Vue.use(Notification)

Vue.prototype.$notify = Notification;

Vue.prototype.$ELEMENT = { size: 'medium' }
2、main.js中代码如下:
import '@/element-ui'
import 'element-ui/lib/theme-chalk/index.css'

重现链接输进去总是报错,就写在下面了:
重现代码网址:https://codesandbox.io/s/qx283lp05j

What is Expected?

Notification 只是引入了并没有使用时,页面刷新后不出现空白Notification

What is actually happening?

Notification 只是引入了并没有使用,页面刷新右上角却总后有一个空白Notification出现

Most helpful comment

在文档中描述的已经很清楚了。http://element-cn.eleme.io/#/zh-CN/component/quickstart
https://codesandbox.io/s/o6yy5m919

// 而不是这样
// Vue.use(Notification);
Vue.prototype.$notify = Notification;

All 4 comments

Translation of this issue:

Element UI version
2.4.6

OS/Browsers version
Windows7/google version 69.0.3497.81 (official version) (64 bits)

Vue version
2.5.2

Reproduction Link
https://jsfiddle.net/mmx38qxw/

Steps to reproduce

  1. Adopting the step of loading element-ui component on demand, Notification component is introduced into elemnet-ui/index.js.

Import Vue from'vue'
Import {

Notification
} from'element-ui'

Vue.use (Notification)
Vue.prototype.$notify = Notification;

Vue.prototype.$ELEMENT = {size:'medium'}
2, the code in main.js is as follows:

Import'@/element-ui'
Import'element-ui/lib/theme-chalk/index.css'

The link is always wrong, and it is written below.
Recurrence code address: https://codesandbox.io/s/qx283lp05j

What is Expected?
When Notification is introduced and is not used, there is no blank Notification after the page refreshes.

What is actually happening?
Notification is only introduced and not used, but a blank Notification appears after the page refreshes in the upper right corner

在文档中描述的已经很清楚了。http://element-cn.eleme.io/#/zh-CN/component/quickstart
https://codesandbox.io/s/o6yy5m919

// 而不是这样
// Vue.use(Notification);
Vue.prototype.$notify = Notification;

Hi did you find the solution to this issue ?

The quickstart, at least in English, isn't clear to me but as @ziyoung says we should use the prototype version not the .use one, which is fine by me and fixed the issue

Was this page helpful?
0 / 5 - 0 ratings