|
|
|
@ -21,6 +21,7 @@
|
|
|
|
h: 2,
|
|
|
|
h: 2,
|
|
|
|
type: 'image',
|
|
|
|
type: 'image',
|
|
|
|
name: '图片',
|
|
|
|
name: '图片',
|
|
|
|
|
|
|
|
background: '#fff',
|
|
|
|
image: '',
|
|
|
|
image: '',
|
|
|
|
eventsType: 'click',
|
|
|
|
eventsType: 'click',
|
|
|
|
eventsAction: '',
|
|
|
|
eventsAction: '',
|
|
|
|
@ -157,7 +158,7 @@
|
|
|
|
let el = $(currentComponent.el).find('.grid-stack-item-content');
|
|
|
|
let el = $(currentComponent.el).find('.grid-stack-item-content');
|
|
|
|
el.css('background', '');
|
|
|
|
el.css('background', '');
|
|
|
|
if (currentComponent.image) {
|
|
|
|
if (currentComponent.image) {
|
|
|
|
el.css('background', `url(${currentComponent.image}) no-repeat center center`).css('background-size', 'cover');
|
|
|
|
el.find('img').attr('src', currentComponent.image);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentComponent.background) {
|
|
|
|
if (currentComponent.background) {
|
|
|
|
el.css('background', currentComponent.background);
|
|
|
|
el.css('background', currentComponent.background);
|
|
|
|
@ -171,7 +172,9 @@
|
|
|
|
var setCurrentFocusStyle = function () {
|
|
|
|
var setCurrentFocusStyle = function () {
|
|
|
|
if (currentComponent) {
|
|
|
|
if (currentComponent) {
|
|
|
|
let el = $(currentComponent.el).find('.grid-stack-item-content');
|
|
|
|
let el = $(currentComponent.el).find('.grid-stack-item-content');
|
|
|
|
el.css('background', currentComponent.focusedStyle_background);
|
|
|
|
if (currentComponent.focusedStyle_background) {
|
|
|
|
|
|
|
|
el.css('background', currentComponent.focusedStyle_background);
|
|
|
|
|
|
|
|
}
|
|
|
|
el.css('border-color', currentComponent.focusedStyle_border_color);
|
|
|
|
el.css('border-color', currentComponent.focusedStyle_border_color);
|
|
|
|
el.css('border-width', currentComponent.focusedStyle_border_width + 'px');
|
|
|
|
el.css('border-width', currentComponent.focusedStyle_border_width + 'px');
|
|
|
|
el.css('transform', `scale(${currentComponent.focusedStyle_scale})`);
|
|
|
|
el.css('transform', `scale(${currentComponent.focusedStyle_scale})`);
|
|
|
|
@ -287,9 +290,10 @@
|
|
|
|
el.find('.grid-stack-item-content').css('background', value);
|
|
|
|
el.find('.grid-stack-item-content').css('background', value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
image: function (el, value) {
|
|
|
|
image: function (el, value, component) {
|
|
|
|
if (!value) return;
|
|
|
|
if (!value) return;
|
|
|
|
el.find('.grid-stack-item-content').css('background', `url(${value}) no-repeat center center`).css('background-size', 'cover');
|
|
|
|
// el.find('.grid-stack-item-content').css('background', `url(${value}) no-repeat center center`).css('background-size', 'cover');
|
|
|
|
|
|
|
|
el.find('img').attr('src', value);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
fontSize: function (el, value) {
|
|
|
|
fontSize: function (el, value) {
|
|
|
|
if (!value) return;
|
|
|
|
if (!value) return;
|
|
|
|
@ -307,9 +311,11 @@
|
|
|
|
if (!value) return;
|
|
|
|
if (!value) return;
|
|
|
|
el.find('span').css('font-weight', value);
|
|
|
|
el.find('span').css('font-weight', value);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
focusedStyle_background: function (el, value) {
|
|
|
|
focusedStyle_background: function (el, value, component) {
|
|
|
|
if (!value) return;
|
|
|
|
if (!value) return;
|
|
|
|
el.find('.grid-stack-item-content').css('background', value);
|
|
|
|
if (currentComponent && currentComponent.id === component.id) {
|
|
|
|
|
|
|
|
el.find('.grid-stack-item-content').css('background', value);
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
focusedStyle_border_width: function (el, value) {
|
|
|
|
focusedStyle_border_width: function (el, value) {
|
|
|
|
if (!value) return;
|
|
|
|
if (!value) return;
|
|
|
|
@ -335,7 +341,7 @@
|
|
|
|
// 遍历并执行对应的策略
|
|
|
|
// 遍历并执行对应的策略
|
|
|
|
propsToHandle.forEach((prop) => {
|
|
|
|
propsToHandle.forEach((prop) => {
|
|
|
|
if (componentStrategies[prop] && component[prop] !== undefined) {
|
|
|
|
if (componentStrategies[prop] && component[prop] !== undefined) {
|
|
|
|
componentStrategies[prop](el, component[prop]);
|
|
|
|
componentStrategies[prop](el, component[prop], component);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|