@Ibishka

У меня есть несколько картинок как получить width у всех и написать определенный width каждому?

export default {
  data() {
    return {
      galleries: [],
      videos: [],
      galleriesList: [
        {
          img: "gallery1.jpg"
        },
        {
          img: "gallery2.jpg"
        },
        {
          img: "gallery3.jpg"
        },
        {
          img: "gallery4.jpg"
        }
      ],
      videosList: [
        {
          img: "video1.jpg",
          video: "video1.mp4"
        },
        {
          img: "video2.jpg",
          video: "video2.mp4"
        },
        {
          img: "video3.jpg",
          video: "video3.mp4"
        }
      ]
    };
  },
  methods: {
    getGalleries() {
      this.galleries = this.galleriesList;
    },
    getVideos() {
      this.videos = this.videosList;
    },
    insertVideo(e) {
      // <source src="${require(`@/assets/videos/video${event.target.dataset.video}.ogv`)}" type="video/ogg">
      // e.target.parentNode.classList.remove("fill");
      e.target.parentNode.innerHTML = `<video autoplay controls><source src="${require(`@/assets/videos/${event.target.dataset.video}`)}" type="video/mp4">Your browser does not support the video tag.</video>`;
      this.$parent.onPlay();
    },
    qw() {
      alert(this.$refs.preview.clientWidth);
    }
  },
  created() {
    this.getGalleries();
    this.getVideos();
  },
  mounted() {
    this.qw();
  }
};

Выводит undefined. Хотя элементов видит.
  • Вопрос задан
  • 48 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы