vue-print-nb
安装 npm install vue-print-nb --save
在main.js文件中注册
import Print from ‘vue-print-nb’
Vue.use(Print)
<vi-button type=“primary” v-print="’#printPreview’" @click=“clickPrint”>打印
//打印下面div的内容
借助 iframe
// dom
//配置static静态文件的路径 原生打印模板
//webpack.dev.conf.js
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, ‘…/’, ‘static’),
to: path.resolve(__dirname, ‘…/dist/’, ‘static’)
}
])
//webpack.dev.server.js
app.use(’/static’, express.static(path.join(config.dev.assetsRoot, ‘static’)));
//webpack.prod.conf.js
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, ‘…/static’),
to: ‘static’,
ignore: [’.*’]
},
{
from: path.resolve(__dirname, ‘…/’, ‘other’),