File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 11var setTitle = function setTitle ( ) {
22 var title = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : null ;
3+ var debug = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : true ;
34
45 // 验证参数
56 if ( title instanceof String ) {
67 return ;
78 }
89 // 设置标题
910 document . title = title ;
11+ // 开启debug
12+ // 在开发者模式下创建iframe会造成多次重绘
13+ // 不建议关闭
14+ if ( debug ) {
15+ return ;
16+ }
1017 // 兼容ios
1118 var $iframe = document . createElement ( 'iframe' ) ;
1219 // set attribute
@@ -292,7 +299,9 @@ var install = function install(Vue) {
292299 var options = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : { } ;
293300
294301 // 获取配置
295- var router = options . router ,
302+ var _options$debug = options . debug ,
303+ debug = _options$debug === undefined ? true : _options$debug ,
304+ router = options . router ,
296305 store = options . store ,
297306 _options$title = options . title ,
298307 title = _options$title === undefined ? false : _options$title ,
@@ -357,7 +366,7 @@ var install = function install(Vue) {
357366 var _to$meta$title = to . meta . title ,
358367 toTitle = _to$meta$title === undefined ? null : _to$meta$title ;
359368
360- setTitle ( toTitle ) ;
369+ setTitle ( toTitle , debug ) ;
361370 }
362371 // 调起钩子函数
363372 after ( r ) ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ let hook = function () {}
2626const install = function ( Vue , options = { } ) {
2727 // 获取配置
2828 const {
29+ debug = true ,
2930 router,
3031 store,
3132 title = false ,
@@ -73,7 +74,7 @@ const install = function (Vue, options = {}) {
7374 // 进行标题处理
7475 if ( title ) {
7576 const { title : toTitle = null } = to . meta
76- setTitle ( toTitle )
77+ setTitle ( toTitle , debug )
7778 }
7879 // 调起钩子函数
7980 after ( r )
Original file line number Diff line number Diff line change 11
2- export const setTitle = function ( title = null ) {
2+ export const setTitle = function ( title = null , debug = true ) {
33 // 验证参数
44 if ( title instanceof String ) {
55 return
66 }
77 // 设置标题
88 document . title = title
9+ // 开启debug
10+ // 在开发者模式下创建iframe会造成多次重绘
11+ // 不建议关闭
12+ if ( debug ) {
13+ return
14+ }
915 // 兼容ios
1016 const $iframe = document . createElement ( 'iframe' )
1117 // set attribute
You can’t perform that action at this time.
0 commit comments