与打印插件获取的打印机做交互
This commit is contained in:
@@ -212,6 +212,7 @@
|
||||
} from './utils/printDotBridge';
|
||||
import { normalizeImportedNativeSchema } from './native/core/nativeSchemaNormalize';
|
||||
import { renderNativePrintHtml } from './native/core/printRenderer';
|
||||
import { PRINT_TEMPLATE_SELECTED_PRINTER_KEY } from './utils/printNativeViaPrintDot';
|
||||
|
||||
defineOptions({ name: 'PrintTemplateList' });
|
||||
|
||||
@@ -304,7 +305,6 @@
|
||||
});
|
||||
|
||||
let hiprint: any = null;
|
||||
const PRINTER_STORAGE_KEY = 'print_template_selected_printer';
|
||||
function resolveHiprint(module: any) {
|
||||
const defaultExport = module?.default || {};
|
||||
hiprint = module?.hiprint || defaultExport?.hiprint || (window as any)?.hiprint;
|
||||
@@ -1637,10 +1637,10 @@
|
||||
selectedPrinterName,
|
||||
(value) => {
|
||||
if (!value) {
|
||||
localStorage.removeItem(PRINTER_STORAGE_KEY);
|
||||
localStorage.removeItem(PRINT_TEMPLATE_SELECTED_PRINTER_KEY);
|
||||
return;
|
||||
}
|
||||
localStorage.setItem(PRINTER_STORAGE_KEY, value);
|
||||
localStorage.setItem(PRINT_TEMPLATE_SELECTED_PRINTER_KEY, value);
|
||||
},
|
||||
{ immediate: false },
|
||||
);
|
||||
@@ -1651,7 +1651,7 @@
|
||||
} catch (_error) {
|
||||
// ignore
|
||||
}
|
||||
selectedPrinterName.value = localStorage.getItem(PRINTER_STORAGE_KEY) || '__system_default__';
|
||||
selectedPrinterName.value = localStorage.getItem(PRINT_TEMPLATE_SELECTED_PRINTER_KEY) || '__system_default__';
|
||||
await refreshPrinterOptions(false);
|
||||
if (!selectedPrinterName.value) {
|
||||
selectedPrinterName.value = '__system_default__';
|
||||
|
||||
Reference in New Issue
Block a user