【发布时间】:2016-09-02 14:27:22
【问题描述】:
我的托管服务提供商自动更新到 4.5,导致 Visual Composer 插件出错。
我确实阅读了这些帖子: Plugin throwing TypeError after Wordpress 4.5 update
Visual composer doesn't load and gives TypeError: _.template(...).trim is not a function
Uncaught TypeError: $template.get is not a function
并将 html2element 函数替换为提供的函数。但是,正如许多人对这些帖子发表评论一样,我收到了一个新错误:
composer-view.js?ver=4.6.1:139 Uncaught TypeError: Cannot read property 'attributes' of undefined
这是我的功能:
html2element: function(html) {
var $template, attributes = {},
template = html;
$template = $(template(this.model.toJSON()).trim()), _.each($template.get(0).attributes, function(attr) {
attributes[attr.name] = attr.value
}), this.$el.attr(attributes).html($template.html()), this.setContent(), this.renderContent()
},
错误似乎来自这一行:
$template.get(0).attributes
有人知道怎么解决吗?
感谢您的帮助
【问题讨论】:
标签: javascript jquery wordpress