node.js - phantomjs 自定义 header 问题请教
天蓬老师
天蓬老师 2017-04-17 14:27:09
[Node.js讨论组]

我在外部变量 title = "标题"

            var title ="标题"
            var config = {
                width: "1040px",
                height: "1414px",
                borderLeft: "5px solid #000",
                margin: {
                    top: "0px",
                    left: "15px",
                    right: "5px",
                    bottom: "0px"
                },
                orientation: "portrait",
                header: {
                    height: 315,
                    contents: phInstance.callback(function(page, num) {
                    //这里的 title 获取不到 
                    return title;
                })
                },
                footer: {
                    height: 50,
                    contents: phInstance.callback(function(pageNum, numPages) {
                        return "<p style='border-top:8px dashed #000'></p><p style='text-align:center;'>底部" + pageNum + "/" + numPages + "</p>";
                    })
                }
            }

报错信息

info: undefined:1 in render
info: phantomjs://code/shim.js:191 in executeCommand
info: phantomjs://code/shim.js:141 in read
info: SyntaxError: Unexpected EOF

请教下使用过的朋友 我这块怎么去设置自定义标题

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号