如何在事件FullCalendar中添加选择框

时间:2019-12-02 13:19:28

标签: javascript html fullcalendar fullcalendar-4

如何在事件中添加选择框?我使用eventRender,但是在渲染之后,该字段为空,并且无法更改值。

    eventRender: function(info) {
        var content = info.el.children[0];
        var eventProps = info.event.extendedProps;
        if(info.event.allDay){
            content.innerHTML = eventProps.name+'<br>'+eventProps.phone;
        }else{
            let apartment = eventProps.apartment == 0 || eventProps.apartment == null ? '' : eventProps.apartment;
            content.children[1].remove();
            var districtDiv = document.createElement('div');
            districtDiv.style.float = 'right';
            districtDiv.innerHTML = eventProps.district;
            content.insertBefore(districtDiv, content.firstChild);
            var newDiv = document.createElement('div');
            var html = `<div>
                            <div>${eventProps.street}</div>
                            <div>
                                <select class="select">
                                    <option value="" disabled selected>Type</option>
                                    <option>Type 1</option>
                                    <option>Type 2</option>
                                </select>
                                Ap: ${apartment}
                            </div>
                        </div>`;
            newDiv.innerHTML = html;
            content.appendChild(newDiv);
        }
    },
     eventClick: function(info) {
        if(info.jsEvent.target.className == 'select') return false;
    }

结果:

enter image description here

0 个答案:

没有答案