Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这个插件怎么让图片自适应? #39

Open
churjan opened this issue Apr 18, 2018 · 3 comments
Open

这个插件怎么让图片自适应? #39

churjan opened this issue Apr 18, 2018 · 3 comments

Comments

@churjan
Copy link

churjan commented Apr 18, 2018

我想要一个类似于微博里面点击放大图片的效果,那个预览时的大图高是自适应的,不用自己设置的,怎么弄?还有这插件支持rem单位吗?

@wrysmile7
Copy link

目前不能自适应,要自己去想办法

@leekafai
Copy link

@churjan

                  <div v-if="verContent.feed.media==='images'" @click="previewImages" ref="images">
                    <vue-preview :slides="verContent.feed.images" @close="handleClose"></vue-preview>
                  </div>
    previewImages: function(event) {
      this.$nextTick(() => {
        let imgs = document.querySelectorAll('.my-gallery a img')
        let images = []
        console.log(imgs)
        imgs.forEach(imgTag => {
          images.push([imgTag.naturalWidth, imgTag.naturalHeight])
        })
        console.log(images)
        let as = document.querySelectorAll('.my-gallery a')
        as.forEach((aTag, index) => {
          aTag.setAttribute(
            'data-size',
            `${images[index][0]}x${images[index][1]}`
          )
        })
      })
    },

@guxuehua
Copy link

第一次打开没有高度

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants