rename id option to toolbarId avoid conflicts with Backbone.View options
This commit is contained in:
Родитель
897f95a417
Коммит
364c7d06f0
|
@ -3,7 +3,7 @@ import 'bootstrap-webpack';
|
||||||
|
|
||||||
window.toolbar = new ToolbarView({
|
window.toolbar = new ToolbarView({
|
||||||
el: '.toolbar-container',
|
el: '.toolbar-container',
|
||||||
id: 'demo-toolbar',
|
toolbarId: 'demo-toolbar',
|
||||||
items: [{
|
items: [{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
classes: ['btn', 'btn-primary'],
|
classes: ['btn', 'btn-primary'],
|
||||||
|
|
|
@ -49,12 +49,12 @@ function renderItemTree(root) {
|
||||||
|
|
||||||
export class ToolbarView extends Backbone.View {
|
export class ToolbarView extends Backbone.View {
|
||||||
initialize({
|
initialize({
|
||||||
id = _.uniqueId('toolbar-'),
|
toolbarId = _.uniqueId('toolbar-'),
|
||||||
classes = [],
|
classes = [],
|
||||||
items = [],
|
items = [],
|
||||||
events = {},
|
events = {},
|
||||||
}) {
|
}) {
|
||||||
this._root = { type: 'toolbar', id, classes, items };
|
this._root = { type: 'toolbar', id: toolbarId, classes, items };
|
||||||
this._events = events;
|
this._events = events;
|
||||||
this._contexts = renderItemTree(this._root);
|
this._contexts = renderItemTree(this._root);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче