[英]Converse.js render into a container
是否可以配置Converse.js将它的框呈现为自定义div
容器而不是将它们添加到页面主体?
Yes, you can do this by writing a converse.js plugin in which you override the insertIntoPage method of ChatBoxView
. 是的,你可以通过编写这样做converse.js插件,在您覆盖insertIntoPage的方法ChatBoxView
。
Refer to the plugin documentation I linked to above. 请参阅我上面链接的插件文档。 In short, it would look something like this: 简而言之,它看起来像这样:
// The following line registers your plugin.
converse_api.plugins.add('myplugin', {
overrides: {
// If you want to override some function or a Backbone model or
// view defined inside converse, then you do that under this
// "overrides" namespace.
ChatBoxView: {
insertIntoPage: function (type, status_message, jid) {
// XXX Your custom code comes here.
// The standard code looks as follows:
this.$el.insertAfter(converse.chatboxviews.get("controlbox).$el);
return this;
}
},
}
UPDATE: Since recent versions of converse.js, the method to override is instead _ensureElement and not insertIntoPage
. 更新:从最近版本的converse.js开始,覆盖的方法是_ensureElement而不是insertIntoPage
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.