我对撇号知之甚少,但我试图创建一个自定义插件。我想在我的小工具三个方面:无法保存图片在插件中插入图案
- 标题(字符串)
- 描述(字符串)
- 一个图像
我还没有找到一种方法来在窗口小部件添加图像作为领域。
现在,我在小部件内部添加了一个单例,它工作正常。但当添加一个图像时,它会显示在页面上,但是当我重新加载页面时,图像不见了。
我widget.html
代码
<div class="md-jumbotron">
<div class="md-grid">
<h1>{{ data.widget.heading }}</h1>
<h6>{{ data.widget.desc }}</h6>
<div class="img">
{{ apos.singleton(data.page, 'jumbotroPic', 'apostrophe-images', {
limit: 1,
size: 'full'
}) }}
</div>
</div>
我得到了在控制台下面
$ node app.js
WARNING: No session secret provided, please set the `secret` property of the
`session` property of the apostrophe-express module in app.js
WARNING: widget type text exists in content but is not configured
WARNING: widget type text exists in content but is not configured
I see no data/address file, defaulting to address 0.0.0.0
I see no data/port file, defaulting to port 3000
Listening on 0.0.0.0:3000
WARNING: widget type text exists in content but is not configured
WARNING: widget type text exists in content but is not configured
WARNING: widget type text exists in content but is not configured
WARNING: widget type text exists in content but is not configured
我的窗口小部件的JavaScript代码是:
module.exports = {
extend: 'apostrophe-widgets',
label: 'Jumbotron',
addFields: [
{
name: 'heading',
type: 'string',
label: 'Heading',
required: true
},
{
name: 'desc',
type: 'string',
label: 'Description',
required: true
}
],
construct: function(self, options) {
var superPushAssets = self.pushAssets;
self.pushAssets = function() {
superPushAssets();
self.pushAsset('stylesheet', 'jumbotron', { when: 'always' });
};
}
};