All Projects → egoist → Vue Media

egoist / Vue Media

Licence: mit
A CSS media query component for Vue.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Media

Midia
Simple Media manager for your Laravel project
Stars: ✭ 126 (-33.33%)
Mutual labels:  media
Docker Kodi
Dockerized Kodi with audio and video
Stars: ✭ 157 (-16.93%)
Mutual labels:  media
Shaden
🎧 A modular audio synthesizer.
Stars: ✭ 175 (-7.41%)
Mutual labels:  media
Prism Media
Easily transcode media using Node.js 🎶
Stars: ✭ 136 (-28.04%)
Mutual labels:  media
Media Docker
all-in-one deployment and configuration for an all-in-one media server, running on docker.
Stars: ✭ 148 (-21.69%)
Mutual labels:  media
Photos
📸 Your memories under your control
Stars: ✭ 157 (-16.93%)
Mutual labels:  media
Synology
Cheatsheet and bash scripts sripts for Synology Nas Stations cheet cheat sheet nas networkdisk
Stars: ✭ 125 (-33.86%)
Mutual labels:  media
Render Media
Intelligently render media files in the browser
Stars: ✭ 181 (-4.23%)
Mutual labels:  media
Nextlevel
NextLevel was initally a weekend project that has now grown into a open community of camera platform enthusists. The software provides foundational components for managing media recording, camera interface customization, gestural interaction customization, and image streaming on iOS. The same capabilities can also be found in apps such as Snapchat, Instagram, and Vine.
Stars: ✭ 1,940 (+926.46%)
Mutual labels:  media
Ktvhttpcache
A powerful media cache framework.
Stars: ✭ 2,113 (+1017.99%)
Mutual labels:  media
Androidcamera
🔥🔥🔥自定义Android相机(仿抖音 TikTok),其中功能包括视频人脸识别贴纸,美颜,分段录制,视频裁剪,视频帧处理,获取视频关键帧,视频旋转,添加滤镜,添加水印,合成Gif到视频,文字转视频,图片转视频,音视频合成,音频变声处理,SoundTouch,Fmod音频处理。 Android camera(imitation Tik Tok), which includes video editor,audio editor,video face recognition stickers, segment recording,video cropping, video frame processing, get the first video frame, key frame, v…
Stars: ✭ 2,112 (+1017.46%)
Mutual labels:  media
Media Embed
A PHP library to deal with all those media services around, parsing their URLs and displaying their audios/videos.
Stars: ✭ 143 (-24.34%)
Mutual labels:  media
Pbjvision
📸 iOS Media Capture – features touch-to-record video, slow motion, and photography
Stars: ✭ 1,940 (+926.46%)
Mutual labels:  media
React Jplayer
Html5 audio and video player library for React
Stars: ✭ 128 (-32.28%)
Mutual labels:  media
Sickchill
Less rage, more chill.
Stars: ✭ 2,166 (+1046.03%)
Mutual labels:  media
Srgmediaplayer Apple
An advanced media player library, simple and reliable
Stars: ✭ 123 (-34.92%)
Mutual labels:  media
Isobmff
C++ Library for ISO/IEC 14496-12 - ISO Base Media File Format (QuickTime, MPEG-4, HEIF, etc)
Stars: ✭ 157 (-16.93%)
Mutual labels:  media
Atgmediabrowser
Image slide-show viewer with multiple predefined transition styles, with ability to create new transitions with ease.
Stars: ✭ 186 (-1.59%)
Mutual labels:  media
Filepicker
FilePicker library for Android
Stars: ✭ 181 (-4.23%)
Mutual labels:  media
Multisite Global Media
Share a media library across the WordPress Multisite network
Stars: ✭ 162 (-14.29%)
Mutual labels:  media

vue-media

NPM version NPM downloads Build Status donate

Like react-media but for Vue.js, and this library is pretty small, it's 969 bytes after minification without gzip.

Install

yarn add vue-media

CDN: https://unpkg.com/vue-media/dist

Usage

<template>
  <div id="app">
    <media :query="{minWidth: 500}">bigger than 500px</media>
    <media :query="{maxWidth: 500}">smaller than 500px</media>
  </div>
</template>

<script>
  import Media from 'vue-media'
  // Component is automatically registered if using CDN.
  export default {
    components: {
      Media
    }
  }
</script>

The value of query can also be a media query string like (max-width: 500px), for more info please see json2mq doc.

The media component will only return the first element or component passed to it. Example:

<template>
  <media :query="{maxWidth: 600}">
    <h2>hello world</h2>
    <my-other-component></my-other-component> <!-- this will not be used! -->
  </media>
</template>

Events

Use the media-enter and media-leave events.

<template>
  <div>
    <media 
      :query="{maxWidth: 600}"
      @media-enter="mediaEnter"
      @media-leave="mediaLeave"
    >
      <h2>Hello world</h2>
    </media>
    <h2 v-if="greaterThan600">I'm now wider than 600!</h2>
  </div>
</template>

<script>
import Media from 'vue-media'

export default {
  components: {
    Media
  },
  data() {
    return {
      greaterThan600: window.innerWidth > 600
    }
  },
  methods: {
    mediaEnter(mediaQueryString) {
      this.greaterThan600 = false
    },
    mediaLeave(mediaQueryString) {
      this.greaterThan600 = true
    }
  }
}
</script>

The first argument of the listener is a mediaQueryString like (min-width: 400px).

Props

Prop Type Default Description
visibleByDefault boolean false Whether to show the element by default.

Browser support

If you want to support legacy browsers (ie <= 10), please include a window.matchMedia polyfill.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

vue-media © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @_egoistlily

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].