GithubHelp home page GithubHelp logo

v-for 元素全屏请教 about vue-fullscreen HOT 8 CLOSED

mirari avatar mirari commented on June 4, 2024
v-for 元素全屏请教

from vue-fullscreen.

Comments (8)

mirari avatar mirari commented on June 4, 2024

vue的某个版本以后修改fullscreen属性的触发方式可能会被浏览器判定为非同步操作从而阻止,所以目前只能尽量使用直接执行方法的形式来调用全屏api。
通过refs来获取当前组件的fullscreen子组件并执行show或者toggle方法。
v-for这种情况你需要在循环里生成不同的ref,然后在回调里定位到响应的fullscreen组件后执行方法。

from vue-fullscreen.

yzhang921 avatar yzhang921 commented on June 4, 2024

嗯, 通过动态的给循环item生成ref, toggle方法生效了, 但是又遇到了新的问题, 非fullscreen组件全屏, 周边的系统菜单都还在, 是还需要添加css引用吗?
我的vue版本"vue": "^2.5.16",

from vue-fullscreen.

mirari avatar mirari commented on June 4, 2024

没看懂……非fullscree组件是啥?系统菜单是指什么

from vue-fullscreen.

yzhang921 avatar yzhang921 commented on June 4, 2024

我的理解全屏应该只显示里面的内容才对

                                    <fullscreen :ref="item.i">
                                        <widget :widgetId="item.widgetId" :w="item.version"></widget>
                                    </fullscreen>

下面是实际的全屏效果, 左边和上面是非<fullscreen 里面的内容, 这种情况是css冲突了吗?

image

from vue-fullscreen.

mirari avatar mirari commented on June 4, 2024

正常情况下是应该只显示里面的内容,如果能看到左侧和上面的元素,说明被全屏的是body元素而不是全屏组件。需要看下你的方法代码是怎么写的。

from vue-fullscreen.

yzhang921 avatar yzhang921 commented on June 4, 2024

template

<grid-item class="grid-item" v-for="item in boardData.layout.data" :key="item.i"
           :x="item.x" :y="item.y" :w="item.w" :h="item.h" :i="item.i"
           @resized="item.version++">
    <div class="box-tools pull-right">
        <button type="button" class="btn btn-sm" @click="toggle(item)">
            <i class="fa fa-square-o"></i>
        </button>
        <button type="button" class="btn btn-sm" @click="removeWidget(item)">
            <i class="fa fa-times"></i>
        </button>
    </div>
    <fullscreen :ref="item.i">
        <widget :widgetId="item.widgetId" :w="item.version"></widget>
    </fullscreen>
</grid-item>
methods: {
            toggle(item) {
                console.log(this.$refs[item.i])
                this.$refs[item.i][0].toggle(true);
            },

from vue-fullscreen.

mirari avatar mirari commented on June 4, 2024

https://codepen.io/mirari/pen/QrxZLo
我试了下没有发现问题啊

from vue-fullscreen.

yzhang921 avatar yzhang921 commented on June 4, 2024

好的, 非常感谢你的支持, 我在看看是不是我的项目样式里面出了什么问题

from vue-fullscreen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.