Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
204 views
in Technique[技术] by (71.8m points)

vue.js - Elements library - how to use image as popover item reference

I want to use Elements popover library https://element.eleme.io/#/en-US/component/popover#popover so that when I click on the image showing the liquid on my page I could see a popover displaying a bigger image. It works on the button but I have a problem with using it on an image. Has anyone done it successfully?

When I comment:

<img
slot="reference"
:src="item.image"
class="image"
@click="showBigPicture(item)"
/>

and add button

<el-button slot="reference"
>View item image</el-button
>

I can click on the button to display image : enter image description here

But when I do otherwise and click on the image e.g. wine I get an error: enter image description here

Bigger part of the code:

                <el-row>
                    <el-card :body-style="{ padding: '0px' }">
                        <el-popover
                            placement="top"
                            :title="itemCategory"
                            style="height: 300px"
                            width="200"
                            trigger="click"
                        >
                            <img
                                slot="reference"
                                :src="item.image"
                                class="image"
                                @click="showBigPicture(item)"
                            />
                            <!-- <el-button slot="reference"
                                >View item image</el-button
                            > -->
                            <el-card
                                :body-style="{
                                    padding: '0px',
                                    position: absolute,
                                    transform: 'translate(-20%, 0%)'
                                }"
                            >
                                <img :src="item.image" />
                            </el-card>
                        </el-popover>
                        <div style="padding: 14px">
                            <span>{{ item.category }}</span>
                            <div class="bottom clearfix"></div>
                        </div>
                    </el-card>
                </el-row>

Can anyone solve this issue? Is is possible to be solved? I thought that addding slot="reference" on the image will be enought but it looks like it is not.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...