语法错误:运算符'='的左侧必须为参考

时间:2019-06-28 16:18:49

标签: javascript reference syntax-error underscore.js operator-keyword

我希望有人可以提供帮助,因为我不知道如何处理此错误。

我正在升级现有网站。在我升级到Wordpress 5.2.2–en_CA之前,我的临时新站点tempsite和插件都工作正常。

现在出现以下错误:

 `SyntaxError: Left hand side of operator '=' must be a reference`

这是迷你日历的实例代码。

<div class="clndr-controls">
    <div class="current-month"><%= month %> <%= year %></div>
    <div class="clndr-nav clndr-clearfix">
        <div class="clndr-previous-button">‹</div>
        <div class="clndr-next-button">›</div>
    </div>
</div>
<div class="clndr-grid">
    <div class="days-of-the-week clndr-clearfix">
        <% _.each(daysOfTheWeek, function(day) { %>
        <div class="header-day"><%= day %></div>
        <% }); %>
    </div>
    <div class="days clndr-clearfix">
        <% _.each(days, function(day) { %>
        <div class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span></div>
    <% }); %>
    </div>
</div>
<div class="event-listing">
    <div class="event-listing-title">Events</div>
    <% _.each(eventsThisMonth, function(event) { %>
        <% if (event.url) {  %><a target="<%= event.url_target %>" href="<%= event.url %>" <% } else {  %><div <% }  %> class="event-item clndr-clearfix">
        <span class="event-item-date">
            <% if (event.end != event.start) {
                startMY = moment(event.start).format("MM YY");
                endMY = moment(event.end).format("MM YY");
                if (startMY === endMY) { %>
                    <%= moment(event.start).format("D") %>–<%= moment(event.end).format("D MMMM") %>
                <% } else { %>
                    <%= moment(event.start).format("D MMMM") %> – <%= moment(event.end).format("D MMMM") %>
                    <% } 
                 } else {  %>
                    <%= moment(event.start).format("D MMMM") %>
                <% } %>
            </span>
            <span class="event-item-name"><%= event.title %></span>
            <% if (event.time) {  %>
                <span class="event-item-time"><%= event.time %></span>
            <% } %>
            <% if (event.location){ %>
                <span class="event-item-time"><%= event.location %></span>
            <% } %>
            <span class="event-item-time">With: <%= event.speaker %></span>
            <span class="event-item-desc"><%= event.desc %></span>
        <% if (event.url) {  %></a><% } else {  %></div><% }  %>
    <% }); %>
</div>

这是js对象选项

doneRendering: function() {
    var day=1, week=1, thisCLNDR = $(this)[0]["element"];
    //make the background rows alternate colour
    thisCLNDR.find(".day").each(function() {
        if (day == 8) { day = 1; week++; }
        if (week % 2 === 0) { $(this).addClass("alternate-bg"); }
        day++;
});
//display a notice if there are no events for a month
var thisMonthEvents = thisCLNDR.find(".event-item").length;
if (thisMonthEvents == 0) {
    thisCLNDR.find(".event-listing").append(
        "<div style='text-align:center;' class='event-item'>No events found</div>"
        );
    }
},
weekOffset: 1

enter image description here

0 个答案:

没有答案