mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 09:55:50 +01:00
Feature: Use function instead of logic in mounted function
This commit is contained in:
committed by
Isaac Bythewood
parent
c56320ac5d
commit
c2050fa76f
@@ -20,13 +20,16 @@ Vue.component('pin', {
|
|||||||
props: ['pin', 'args', 'index'],
|
props: ['pin', 'args', 'index'],
|
||||||
template: '#pin-template',
|
template: '#pin-template',
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
this.imageStyle = {
|
this.imageStyle = this.getImageStyle();
|
||||||
width: this.pin.image.thumbnail.width + 'px',
|
|
||||||
height: this.pin.image.thumbnail.height + 'px',
|
|
||||||
};
|
|
||||||
this.pinStyle = this.getPinStyle();
|
this.pinStyle = this.getPinStyle();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getImageStyle: function() {
|
||||||
|
return {
|
||||||
|
width: this.pin.image.thumbnail.width + 'px',
|
||||||
|
height: this.pin.image.thumbnail.height + 'px',
|
||||||
|
}
|
||||||
|
},
|
||||||
getPinStyle: function() {
|
getPinStyle: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
@@ -52,6 +55,7 @@ Vue.component('pin', {
|
|||||||
function getLineNumber(rowSize, index) {
|
function getLineNumber(rowSize, index) {
|
||||||
return Math.floor((index) / rowSize);
|
return Math.floor((index) / rowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineNumber = getLineNumber(self.args.rowSize, self.index);
|
var lineNumber = getLineNumber(self.args.rowSize, self.index);
|
||||||
marginTop = self.args.blockMargin + (self.args.blockMargin + 300) * lineNumber;
|
marginTop = self.args.blockMargin + (self.args.blockMargin + 300) * lineNumber;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user