mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 01:45:51 +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'],
|
||||
template: '#pin-template',
|
||||
mounted: function() {
|
||||
this.imageStyle = {
|
||||
width: this.pin.image.thumbnail.width + 'px',
|
||||
height: this.pin.image.thumbnail.height + 'px',
|
||||
};
|
||||
this.imageStyle = this.getImageStyle();
|
||||
this.pinStyle = this.getPinStyle();
|
||||
},
|
||||
methods: {
|
||||
getImageStyle: function() {
|
||||
return {
|
||||
width: this.pin.image.thumbnail.width + 'px',
|
||||
height: this.pin.image.thumbnail.height + 'px',
|
||||
}
|
||||
},
|
||||
getPinStyle: function() {
|
||||
var self = this;
|
||||
|
||||
@@ -52,6 +55,7 @@ Vue.component('pin', {
|
||||
function getLineNumber(rowSize, index) {
|
||||
return Math.floor((index) / rowSize);
|
||||
}
|
||||
|
||||
var lineNumber = getLineNumber(self.args.rowSize, self.index);
|
||||
marginTop = self.args.blockMargin + (self.args.blockMargin + 300) * lineNumber;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user