-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2093252
commit e30e22c
Showing
4 changed files
with
95 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*! | ||
* vue-aspect-ratio v0.1.0 | ||
* vue-aspect-ratio v0.1.1 | ||
* (c) 2019 [email protected] | ||
* Released under the MIT License. | ||
*/ | ||
|
@@ -60,6 +60,12 @@ function _nonIterableRest() { | |
var script = { | ||
name: "VueAspectRatio", | ||
props: { | ||
/** | ||
* Aspect Ratio. | ||
* String with the following pattern | ||
* <aspect_ratio_width>:<aspect_ratio_height> | ||
* Default is "1:1" meaning that the component will be a square | ||
*/ | ||
ar: { | ||
type: String, | ||
default: "1:1", | ||
|
@@ -73,7 +79,13 @@ var script = { | |
|
||
return !Number.isNaN(w) && !Number.isNaN(h); | ||
} | ||
} | ||
}, | ||
|
||
/** | ||
* Width to set to the component. | ||
* Optional, if not set the width will be 100% like a normal "div" element | ||
*/ | ||
width: String | ||
}, | ||
data: function data() { | ||
return { | ||
|
@@ -84,15 +96,27 @@ var script = { | |
}; | ||
}, | ||
computed: { | ||
/** | ||
* Style for the outer div element, this can just set the width of the component itself | ||
*/ | ||
componentStyle: function componentStyle() { | ||
return this.width ? { | ||
width: this.width | ||
} : {}; | ||
}, | ||
|
||
/** | ||
* Style for the inner div element, this will define the aspect ratio | ||
*/ | ||
innerStyle: function innerStyle() { | ||
// set the padding, this is actually what gives the aspect ratio | ||
// set the padding top, this is actually what gives the aspect ratio | ||
return { | ||
paddingTop: this.h / this.w * 100 + "%" | ||
}; | ||
} | ||
}, | ||
created: function created() { | ||
// set w and h data | ||
// set w and h data parsing the ar prop | ||
var _this$ar$split$map = this.ar.split(":").map(function (v) { | ||
return parseInt(v); | ||
}), | ||
|
@@ -246,17 +270,17 @@ var browser = createInjector; | |
const __vue_script__ = script; | ||
|
||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-aspect-ratio"},[_c('div',{staticClass:"vue-aspect-ratio__inner",style:(_vm.innerStyle)},[_c('div',{staticClass:"vue-aspect-ratio__content"},[_vm._t("default")],2)])])}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-aspect-ratio",style:(_vm.componentStyle)},[_c('div',{staticClass:"vue-aspect-ratio__inner",style:(_vm.innerStyle)},[_c('div',{staticClass:"vue-aspect-ratio__content"},[_vm._t("default")],2)])])}; | ||
var __vue_staticRenderFns__ = []; | ||
|
||
/* style */ | ||
const __vue_inject_styles__ = function (inject) { | ||
if (!inject) return | ||
inject("data-v-69342252_0", { source: ".vue-aspect-ratio__inner[data-v-69342252]{position:relative}.vue-aspect-ratio__content[data-v-69342252]{position:absolute;top:0;left:0;width:100%;height:100%}", map: undefined, media: undefined }); | ||
inject("data-v-f0460d78_0", { source: ".vue-aspect-ratio__inner[data-v-f0460d78]{position:relative}.vue-aspect-ratio__content[data-v-f0460d78]{position:absolute;top:0;left:0;width:100%;height:100%}", map: undefined, media: undefined }); | ||
|
||
}; | ||
/* scoped */ | ||
const __vue_scope_id__ = "data-v-69342252"; | ||
const __vue_scope_id__ = "data-v-f0460d78"; | ||
/* module identifier */ | ||
const __vue_module_identifier__ = undefined; | ||
/* functional template */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*! | ||
* vue-aspect-ratio v0.1.0 | ||
* vue-aspect-ratio v0.1.1 | ||
* (c) 2019 [email protected] | ||
* Released under the MIT License. | ||
*/ | ||
|
@@ -58,6 +58,12 @@ function _nonIterableRest() { | |
var script = { | ||
name: "VueAspectRatio", | ||
props: { | ||
/** | ||
* Aspect Ratio. | ||
* String with the following pattern | ||
* <aspect_ratio_width>:<aspect_ratio_height> | ||
* Default is "1:1" meaning that the component will be a square | ||
*/ | ||
ar: { | ||
type: String, | ||
default: "1:1", | ||
|
@@ -71,7 +77,13 @@ var script = { | |
|
||
return !Number.isNaN(w) && !Number.isNaN(h); | ||
} | ||
} | ||
}, | ||
|
||
/** | ||
* Width to set to the component. | ||
* Optional, if not set the width will be 100% like a normal "div" element | ||
*/ | ||
width: String | ||
}, | ||
data: function data() { | ||
return { | ||
|
@@ -82,15 +94,27 @@ var script = { | |
}; | ||
}, | ||
computed: { | ||
/** | ||
* Style for the outer div element, this can just set the width of the component itself | ||
*/ | ||
componentStyle: function componentStyle() { | ||
return this.width ? { | ||
width: this.width | ||
} : {}; | ||
}, | ||
|
||
/** | ||
* Style for the inner div element, this will define the aspect ratio | ||
*/ | ||
innerStyle: function innerStyle() { | ||
// set the padding, this is actually what gives the aspect ratio | ||
// set the padding top, this is actually what gives the aspect ratio | ||
return { | ||
paddingTop: this.h / this.w * 100 + "%" | ||
}; | ||
} | ||
}, | ||
created: function created() { | ||
// set w and h data | ||
// set w and h data parsing the ar prop | ||
var _this$ar$split$map = this.ar.split(":").map(function (v) { | ||
return parseInt(v); | ||
}), | ||
|
@@ -244,17 +268,17 @@ var browser = createInjector; | |
const __vue_script__ = script; | ||
|
||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-aspect-ratio"},[_c('div',{staticClass:"vue-aspect-ratio__inner",style:(_vm.innerStyle)},[_c('div',{staticClass:"vue-aspect-ratio__content"},[_vm._t("default")],2)])])}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-aspect-ratio",style:(_vm.componentStyle)},[_c('div',{staticClass:"vue-aspect-ratio__inner",style:(_vm.innerStyle)},[_c('div',{staticClass:"vue-aspect-ratio__content"},[_vm._t("default")],2)])])}; | ||
var __vue_staticRenderFns__ = []; | ||
|
||
/* style */ | ||
const __vue_inject_styles__ = function (inject) { | ||
if (!inject) return | ||
inject("data-v-69342252_0", { source: ".vue-aspect-ratio__inner[data-v-69342252]{position:relative}.vue-aspect-ratio__content[data-v-69342252]{position:absolute;top:0;left:0;width:100%;height:100%}", map: undefined, media: undefined }); | ||
inject("data-v-f0460d78_0", { source: ".vue-aspect-ratio__inner[data-v-f0460d78]{position:relative}.vue-aspect-ratio__content[data-v-f0460d78]{position:absolute;top:0;left:0;width:100%;height:100%}", map: undefined, media: undefined }); | ||
|
||
}; | ||
/* scoped */ | ||
const __vue_scope_id__ = "data-v-69342252"; | ||
const __vue_scope_id__ = "data-v-f0460d78"; | ||
/* module identifier */ | ||
const __vue_module_identifier__ = undefined; | ||
/* functional template */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/*! | ||
* vue-aspect-ratio v0.1.0 | ||
* vue-aspect-ratio v0.1.1 | ||
* (c) 2019 [email protected] | ||
* Released under the MIT License. | ||
*/ | ||
|
@@ -64,6 +64,12 @@ | |
var script = { | ||
name: "VueAspectRatio", | ||
props: { | ||
/** | ||
* Aspect Ratio. | ||
* String with the following pattern | ||
* <aspect_ratio_width>:<aspect_ratio_height> | ||
* Default is "1:1" meaning that the component will be a square | ||
*/ | ||
ar: { | ||
type: String, | ||
default: "1:1", | ||
|
@@ -77,7 +83,13 @@ | |
|
||
return !Number.isNaN(w) && !Number.isNaN(h); | ||
} | ||
} | ||
}, | ||
|
||
/** | ||
* Width to set to the component. | ||
* Optional, if not set the width will be 100% like a normal "div" element | ||
*/ | ||
width: String | ||
}, | ||
data: function data() { | ||
return { | ||
|
@@ -88,15 +100,27 @@ | |
}; | ||
}, | ||
computed: { | ||
/** | ||
* Style for the outer div element, this can just set the width of the component itself | ||
*/ | ||
componentStyle: function componentStyle() { | ||
return this.width ? { | ||
width: this.width | ||
} : {}; | ||
}, | ||
|
||
/** | ||
* Style for the inner div element, this will define the aspect ratio | ||
*/ | ||
innerStyle: function innerStyle() { | ||
// set the padding, this is actually what gives the aspect ratio | ||
// set the padding top, this is actually what gives the aspect ratio | ||
return { | ||
paddingTop: this.h / this.w * 100 + "%" | ||
}; | ||
} | ||
}, | ||
created: function created() { | ||
// set w and h data | ||
// set w and h data parsing the ar prop | ||
var _this$ar$split$map = this.ar.split(":").map(function (v) { | ||
return parseInt(v); | ||
}), | ||
|
@@ -250,17 +274,17 @@ | |
const __vue_script__ = script; | ||
|
||
/* template */ | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-aspect-ratio"},[_c('div',{staticClass:"vue-aspect-ratio__inner",style:(_vm.innerStyle)},[_c('div',{staticClass:"vue-aspect-ratio__content"},[_vm._t("default")],2)])])}; | ||
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vue-aspect-ratio",style:(_vm.componentStyle)},[_c('div',{staticClass:"vue-aspect-ratio__inner",style:(_vm.innerStyle)},[_c('div',{staticClass:"vue-aspect-ratio__content"},[_vm._t("default")],2)])])}; | ||
var __vue_staticRenderFns__ = []; | ||
|
||
/* style */ | ||
const __vue_inject_styles__ = function (inject) { | ||
if (!inject) return | ||
inject("data-v-69342252_0", { source: ".vue-aspect-ratio__inner[data-v-69342252]{position:relative}.vue-aspect-ratio__content[data-v-69342252]{position:absolute;top:0;left:0;width:100%;height:100%}", map: undefined, media: undefined }); | ||
inject("data-v-f0460d78_0", { source: ".vue-aspect-ratio__inner[data-v-f0460d78]{position:relative}.vue-aspect-ratio__content[data-v-f0460d78]{position:absolute;top:0;left:0;width:100%;height:100%}", map: undefined, media: undefined }); | ||
|
||
}; | ||
/* scoped */ | ||
const __vue_scope_id__ = "data-v-69342252"; | ||
const __vue_scope_id__ = "data-v-f0460d78"; | ||
/* module identifier */ | ||
const __vue_module_identifier__ = undefined; | ||
/* functional template */ | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.