Registry / web-framework / vue-print-nb-jeecg

vue-print-nb-jeecg

JSON →
library1.0.13jsnpmunverified

The `vue-print-nb-jeecg` package provides a straightforward Vue.js directive (`v-print`) to facilitate printing functionality directly within web applications. It allows developers to easily trigger print operations for either the entire current page or specific designated sections of the DOM, identified via CSS selectors. Currently at version 1.0.13, this library distinguishes itself as a "specific adapted version" (`特定改造版本`), meaning it includes targeted modifications designed to resolve common challenges, particularly addressing Internet Explorer compatibility issues and enhancing support for the adaptive printing of HTML Canvas elements. This makes it a suitable choice for projects requiring robust printing capabilities across diverse browser environments, especially legacy ones. Its integration is minimal, requiring only installation via npm and registration with `Vue.use()`, making it a light-weight and convenient solution. The release cadence appears to be driven by specific project needs, potentially within the `jeecg` ecosystem, rather than a fixed schedule. It is a fork/adaptation of `vue-print-nb`.

npm install vue-print-nb-jeecg
INSTALL
IMPORT
SIG · VUE-PRINT-NB-JEECG
V
vue-print-nb-jeecg
web-frameworkjavascriptv1.0.13
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Print
import Print from 'vue-print-nb-jeecg'
import { Print } from 'vue-print-nb-jeecg'
The plugin is exported as a default export; named imports will not work.
Plugin Registration
Vue.use(Print)
new Vue().use(Print)
The `Print` plugin must be registered globally with the Vue constructor before creating your root Vue instance. This pattern is typical for Vue 2 plugins.
CJS Import
const Print = require('vue-print-nb-jeecg')
const { Print } = require('vue-print-nb-jeecg')
For CommonJS environments, the `module.exports` object is the `Print` plugin itself; destructuring will not correctly resolve the plugin.

Demonstrates how to install, register, and use the `v-print` directive for both full-page and element-specific printing in a Vue 2 application.

import Vue from 'vue'; import Print from 'vue-print-nb-jeecg'; // Register the print directive globally Vue.use(Print); new Vue({ el: '#app', data: { message: 'Hello, Vue Print!' }, template: ` <div id="app"> <h1>{{ message }}</h1> <p>This is some content outside the local print area.</p> <!-- Print the entire page --> <button v-print>Print Entire Page</button> <hr /> <!-- Local print area --> <div id="printMe" style="border: 1px solid blue; padding: 20px; background-color: #f0f8ff;"> <h2>Local Print Content</h2> <p>This section will be printed when the 'Print Local' button is clicked.</p> <ul> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ul> <p>This package is adapted for IE compatibility and Canvas printing.</p> </div> <!-- Print local range --> <button v-print="'#printMe'">Print Local Range</button> </div> ` });
Debug
Known issues
gotchaThis directive triggers the native browser print function. The appearance of the print dialog and the final print output are heavily influenced by the user's browser settings and your application's CSS, especially `@media print` rules. Ensure your print-specific CSS is robust for consistent results across different browsers.
fix
Implement comprehensive `@media print` stylesheets and test across target browsers. This package does not provide styling; it merely initiates the print job.
affects: >=1.0.0
gotchaFor printing local ranges with `v-print="'#selector'"`, ensure the target element and its contents are fully rendered and stable in the DOM before the print directive is activated. Dynamically loaded content or components that haven't fully mounted might not be included in the print job.
fix
Use Vue's reactivity system to ensure content is ready, perhaps by activating the print only after a `nextTick` or when all data dependencies are met. Avoid triggering `v-print` on elements that are still in a transition or rendering state.
affects: >=1.0.0
gotchaWhile `vue-print-nb-jeecg` includes specific adaptations for Internet Explorer compatibility and Canvas adaptive printing, these features may still exhibit nuanced behavior across various IE versions or non-standard browser environments. Thorough cross-browser testing is recommended if these specific features are critical for your application.
fix
Test print functionality extensively on all target browsers, especially older versions of IE and environments where Canvas printing is critical. Adjust content or CSS as needed for specific browser quirks.
affects: >=1.0.0
Errors
Common errors & fixes
[Vue warn]: Failed to resolve directive: print
The `vue-print-nb-jeecg` plugin was not registered with Vue using `Vue.use(Print)` before the Vue application instance was created.
fix
Ensure `import Print from 'vue-print-nb-jeecg'; Vue.use(Print);` is executed in your main application file (e.g., `main.js`) before mounting your root Vue instance.
Uncaught TypeError: Cannot read properties of undefined (reading 'call')
This error can occur if the `Print` module is imported incorrectly (e.g., using a named import when it's a default export) or if `Vue.use()` is called with an undefined or non-plugin object.
fix
Verify the import statement `import Print from 'vue-print-nb-jeecg'` is correct. If using CommonJS, ensure you are using `const Print = require('vue-print-nb-jeecg')` and not destructuring the import.
Upgrade
Version history
1.0.13latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
OpenAI (training)
1
Resources
vue-print-nb-jeecg — npm install vue-print-nb-jeecg · libregistry