//增加存草稿功能
var _this=this;
// 找到目标按钮
const saveButton = document.querySelectorAll('button[data-v-08840551].el-button--small')[1];
// 增加样式
saveButton.classList.add('el-button--primary');
// 修改按钮文本
if (saveButton) {
// 保存原始提交事件处理函数
const originalSubmitHandler = saveButton.onclick;
saveButton.querySelector('span').textContent = '提交';
// 创建存草稿按钮
const newButton = document.createElement('button');
newButton.type = 'button';
newButton.className = 'el-button el-button--default el-button--small';
newButton.setAttribute('data-v-f4ec7e7e', '');
// 创建按钮内的span元素
const newButtonSpan = document.createElement('span');
newButtonSpan.textContent = '存草稿';
newButton.appendChild(newButtonSpan);
// 添加存草稿按钮点击事件
newButton.addEventListener('click', function() {
_this.setFormData({d53:"草稿"});
// 自动触发提交按钮点击
saveButton.click();
});
// 创建提交按钮
const newButton2 = document.createElement('button');
newButton2.type = 'button';
newButton2.className = 'el-button el-button--default el-button--small el-button--primary';
newButton2.setAttribute('data-v-f4ec7e7e', '');
// 创建按钮内的span元素
const newButtonSpan2 = document.createElement('span');
newButtonSpan2.textContent = '提交';
newButton2.appendChild(newButtonSpan2);
// 添加存草稿按钮点击事件
newButton2.addEventListener('click', function() {
_this.setFormData({d53:"已发布"});
// 自动触发提交按钮点击
saveButton.click();
});
saveButton.style.display = 'none'
// 找到保存按钮的父元素
const parent = saveButton.parentNode;
// 在保存按钮前插入新按钮
parent.insertBefore(newButton, saveButton);
parent.insertBefore(newButton2, saveButton);
}
存草稿功能
最新推荐文章于 2025-08-06 18:32:30 发布