Element: popover报错

Created on 7 Oct 2016  ·  15Comments  ·  Source: ElemeFE/element

报错:Uncaught TypeError: Cannot read property '$refs' of undefined

ElementUI version

1.0.0-rc.5

OS/Browers version

macOS/Chrome 53.0.2785.116 (64-bit)

Vue version

2.0.0-rc.8

repro

Most helpful comment

我知道了 是因为按钮写在el-popover前面了。。

All 15 comments

遇到了相同的问题:

设了 ref="popover1" 以后, 错误变成了

index.js?23bf:164 Uncaught TypeError: Cannot read property '0' of undefined

请给出重现 demo 或代码

我这里是用 webpack + partial load:

大致代码如下:

import Button from 'element-ui/lib/button'
import 'element-ui/lib/theme-default/button.css'
import Popover from 'element-ui/lib/popover'
import 'element-ui/lib/theme-default/popover.css'
Vue.component(Popover.name, Popover)
Vue.component(Button.name, Button)

<template>
  <el-popover
    ref="popover1"
    placement="top-start"
    title="标题"
    width="200"
    trigger="hover"
    content="这是一段容,这是一段容,这是一段容,这是一段容。">
  </el-popover>
  <el-button v-popover:popover1>hover 激活</el-button>
</template>

@txchen 我本地用按需加载也是正常的
https://codepen.io/QingWei-Li/pen/gwvyyx

请给出能复现的 demo,不然没法找到问题

我把我 app 里的逻辑剥离出来, 单独开了一个 project, 可惜不能 repro 了

https://github.com/txchen/feplay/tree/gh-pages/elementtest

我继续研究一下.

@QingWei-Li 有一个问题: 我想再 table 里的某一列, hover 或者 click 弹出 popover, 请问应该怎么做? 我在elementtest 用了 inline-template, 但是只有最后一列可以出 popover.

@txchen 有两种用法,还有一种 slot 的方式,具体参考文档

谢谢! slot 方式成功了, 不过还是有问题:
https://github.com/txchen/feplay/commit/6de713d706dcc691e27314c7c8a4f11201a00d44

placement 只能在左或者右, top bottom 就显示不出来了. 貌似 z-index 被 table cell 覆盖住了. 另外行与行之间, popover 出现的位置有偏差.

image
image

@txchen table 样式已经修复了,可以查看 changelog

我在本地按照 https://github.com/ElemeFE/element/commit/4b92796d8e1555e368dfbd38fe5aad5686045e8f 修改 node_modules 里的 table.css, 似乎没有变化.

而且好像这个 commit 也没有调整过 z-index, 遮挡的问题应该还在吧?

@txchen 你用的按需加载?还是引入的是 element-ui/index.css 这个文件?感觉你没正确加载到 table.css 并且改完后要重启下 webpack

改的是 element-ui/lib/theme-default/table.css, 人肉 un minify :)
而且重启过了 webpack 了, 可能是 cache 了.

请问什么时候 release 下一个版本?

应该是我之前没改对, 现在好了.
image

在角上会有 overflow 的问题, 不知道是我没改全还是怎么样? 期待下一个版本

width属性为什么最小宽度 150px?请问如何做到小于这个宽度的值?

我知道了 是因为按钮写在el-popover前面了。。

的确,popover只要在触发的元素前面,就有一定概率出现这问题。

Was this page helpful?
0 / 5 - 0 ratings