mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-02-13 02:18:27 -06:00
29 lines
587 B
JavaScript
29 lines
587 B
JavaScript
export let responsive
|
|
|
|
export default {
|
|
install (Vue, options) {
|
|
const finalOptions = Object.assign({}, {
|
|
computed: {}
|
|
}, options)
|
|
|
|
responsive = new Vue({
|
|
data () {
|
|
return {
|
|
width: window.innerWidth,
|
|
height: window.innerHeight
|
|
}
|
|
},
|
|
computed: finalOptions.computed
|
|
})
|
|
|
|
Object.defineProperty(Vue.prototype, '$responsive', {
|
|
get: () => responsive
|
|
})
|
|
|
|
window.addEventListener('resize', () => {
|
|
responsive.width = window.innerWidth
|
|
responsive.height = window.innerHeight
|
|
})
|
|
}
|
|
}
|