Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/matteogabriele/vue-component-observer

Plugin for responsive components
https://github.com/matteogabriele/vue-component-observer

breakpoints eqcss responsive-design vue

Last synced: 3 months ago
JSON representation

Plugin for responsive components

Awesome Lists containing this project

README

        

# vue-component-observer

Plugin for responsive components

### Installation

```bash
yarn add vue-component-observer
```

### Usage

```js
import VueComponentObserver from "vue-component-observer";

Vue.use(VueComponentObserver);
```

Declare the component breakpoints in the root of the component itself and then use the `$eq` property to render these computations.

```vue


medium


small


export default {
name: "MyComponent",

breakpoints: {
medium: {
minWidth: 600,
},
large: {
minWidth: 1200,
},
},
};

```

### Use Observer component

Use the built-in Observer component

```vue



medium


small



const breakpoints = {
medium: {
minWidth: 600,
},
};

```

### Props list

#### tag
What tag the Observer component should render

default: 'div'

#### slim
Render or not a node element

default: false

#### breakpoints
Observer breakpoints. Supports: minWidth, maxWidth, minHeight and maxHeight

default: null

### Local usage

```vue



medium


small



import { Observer } from "vue-component-observer";

const breakpoints = {
medium: {
minWidth: 600,
},
};

```

```vue


medium


small


import { ObserverMixin } from "vue-component-observer";

export default {
name: "MyComponent",

mixins: [ObserverMixin],

breakpoints: {
medium: {
minWidth: 600,
},
large: {
minWidth: 1200,
},
},
};

```