需要把上圖的中文改為? 切換語言自動切換成英文
找到這個文件
public/assets/js/backend.js
找到如下圖部分??
// //點擊包含.btn-ajax的元素時發送Ajax請求 原頁面// $(document).on('click', '.btn-ajax,.ajaxit', function (e) {// var that = this;// var options = $.extend({}, $(that).data() || {});// if (typeof options.url === 'undefined' && $(that).attr("href")) {// options.url = $(that).attr("href");// }// options.url = Backend.api.replaceids(this, options.url);// var success = typeof options.success === 'function' ? options.success : null;// var error = typeof options.error === 'function' ? options.error : null;// delete options.success;// delete options.error;// var button = Backend.api.gettablecolumnbutton(options);// if (button) {// if (typeof button.success === 'function') {// success = button.success;// }// if (typeof button.error === 'function') {// error = button.error;// }// }// //如果未設備成功的回調,設定了自動刷新的情況下自動進行刷新// if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {// success = function () {// $("#" + options.tableId).bootstrapTable('refresh');// }// }// if (typeof options.confirm !== 'undefined') {// Layer.confirm(options.confirm, function (index) {// Backend.api.ajax(options, success, error);// Layer.close(index);// });// } else {// Backend.api.ajax(options, success, error);// }// return false;// });
修改為
$(document).on('click', '.btn-ajax,.ajaxit', function (e) {var that = this;var options = $.extend({}, $(that).data() || {});if (typeof options.url === 'undefined' && $(that).attr("href")) {options.url = $(that).attr("href");}options.url = Backend.api.replaceids(this, options.url);var success = typeof options.success === 'function' ? options.success : null;var error = typeof options.error === 'function' ? options.error : null;delete options.success;delete options.error;var button = Backend.api.gettablecolumnbutton(options);if (button) {if (typeof button.success === 'function') {success = button.success;}if (typeof button.error === 'function') {error = button.error;}}//如果未設備成功的回調,設定了自動刷新的情況下自動進行刷新if (!success && typeof options.tableId !== 'undefined' && typeof options.refresh !== 'undefined' && options.refresh) {success = function () {$("#" + options.tableId).bootstrapTable('refresh');}}if (typeof options.confirm !== 'undefined') {// 添加自定義確認按鈕文本var confirmOptions = {title: options.confirmTitle || __('Confirm'), // 標題,默認為"Confirm"btn: [{text: options.confirmBtn || __('OK'), // 確認按鈕文本callback: function(index) {Backend.api.ajax(options, success, error);Layer.close(index);}},{text: options.cancelBtn || __('Cancel'), // 取消按鈕文本callback: function(index) {Layer.close(index);}}]};Layer.confirm(options.confirm, {title: options.confirmTitle || __('Confirm'),btn: [options.confirmBtn || __('OK'),options.cancelBtn || __('Cancel')]}, function(index){Backend.api.ajax(options, success, error);Layer.close(index);});} else {Backend.api.ajax(options, success, error);}return false;});
按鈕使用時添加
? ?confirmBtn: 'OK', // Confirm button text in English
cancelBtn: 'Cancel', // Cancel button text in English? 即可
buttons: [{name: 'check',text: __('check'), // 按鈕文字,語言在對應的lang文件設置title: __('check'), // 提示classname: 'btn btn-xs btn-magic btn-ajax',confirm: __('Are you sure the review has been approved?'),confirmBtn: 'OK', // Confirm button text in EnglishcancelBtn: 'Cancel', // Cancel button text in Englishicon: 'fa fa-pencil', // 更換圖標url:'order/check',},