mirror of
				https://github.com/potato47/ccc-devtools.git
				synced 2025-10-30 19:05:48 +00:00 
			
		
		
		
	修复2.1以下版本重复点击节点报错问题
This commit is contained in:
		| @@ -1,4 +1,4 @@ | |||||||
| # ccc-devtools v2.3.0 | # ccc-devtools v2.3.1 | ||||||
| Cocos Creator 网页调试工具,运行时查看、修改节点树,实时更新节点属性,可视化显示缓存资源。 | Cocos Creator 网页调试工具,运行时查看、修改节点树,实时更新节点属性,可视化显示缓存资源。 | ||||||
|  |  | ||||||
| ## 预览 | ## 预览 | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								js/app.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								js/app.js
									
									
									
									
									
								
							| @@ -89,9 +89,9 @@ let app = new Vue({ | |||||||
|         cacheDataLoading: false |         cacheDataLoading: false | ||||||
|     }, |     }, | ||||||
|     methods: { |     methods: { | ||||||
|         api: function(url, cb) { |         api: function (url, cb) { | ||||||
|             let xhr = new XMLHttpRequest(); |             let xhr = new XMLHttpRequest(); | ||||||
|             xhr.onreadystatechange = function() { |             xhr.onreadystatechange = function () { | ||||||
|                 if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) { |                 if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) { | ||||||
|                     let response = xhr.responseText; |                     let response = xhr.responseText; | ||||||
|                     cb(JSON.parse(xhr.responseText)); |                     cb(JSON.parse(xhr.responseText)); | ||||||
| @@ -100,7 +100,7 @@ let app = new Vue({ | |||||||
|             xhr.open("GET", url, true); |             xhr.open("GET", url, true); | ||||||
|             xhr.send(); |             xhr.send(); | ||||||
|         }, |         }, | ||||||
|         compareVersion: function(localVersion, remoteVersion) { |         compareVersion: function (localVersion, remoteVersion) { | ||||||
|             let vL = localVersion.split('.'); |             let vL = localVersion.split('.'); | ||||||
|             let vR = remoteVersion.split('.'); |             let vR = remoteVersion.split('.'); | ||||||
|             for (let i = 0; i < vL.length; ++i) { |             for (let i = 0; i < vL.length; ++i) { | ||||||
| @@ -120,7 +120,7 @@ let app = new Vue({ | |||||||
|                 return false; |                 return false; | ||||||
|             } |             } | ||||||
|         }, |         }, | ||||||
|         checkVersion: function() { |         checkVersion: function () { | ||||||
|             this.api('https://raw.githubusercontent.com/potato47/ccc-devtools/master/version.json', ( |             this.api('https://raw.githubusercontent.com/potato47/ccc-devtools/master/version.json', ( | ||||||
|                 data) => { |                 data) => { | ||||||
|                 let remoteVersion = data.version; |                 let remoteVersion = data.version; | ||||||
| @@ -307,9 +307,9 @@ let app = new Vue({ | |||||||
|         openDevMode() { |         openDevMode() { | ||||||
|             setTimeout(() => { |             setTimeout(() => { | ||||||
|                 if (!cc.Node.prototype.isLeaf) { |                 if (!cc.Node.prototype.isLeaf) { | ||||||
|                     cc.js.getset(cc.Node.prototype, 'isLeaf', function() { |                     cc.js.getset(cc.Node.prototype, 'isLeaf', function () { | ||||||
|                         return this.childrenCount === 0; |                         return this.childrenCount === 0; | ||||||
|                     }, function(value) { |                     }, function (value) { | ||||||
|  |  | ||||||
|                     }, false, true); |                     }, false, true); | ||||||
|                 } |                 } | ||||||
| @@ -358,7 +358,7 @@ let app = new Vue({ | |||||||
|         }, |         }, | ||||||
|         handleChangeStats() { |         handleChangeStats() { | ||||||
|             if (this.$data.isShowProfile) { |             if (this.$data.isShowProfile) { | ||||||
|                 let addStats = function(stats) { |                 let addStats = function (stats) { | ||||||
|                     stats.dom.style.position = 'relative'; |                     stats.dom.style.position = 'relative'; | ||||||
|                     stats.dom.style.float = 'right'; |                     stats.dom.style.float = 'right'; | ||||||
|                     stats.dom.style.marginLeft = '10px'; |                     stats.dom.style.marginLeft = '10px'; | ||||||
| @@ -417,9 +417,9 @@ let app = new Vue({ | |||||||
|         }, |         }, | ||||||
|         initConsoleUtil() { |         initConsoleUtil() { | ||||||
|             if (cc.tree) return; |             if (cc.tree) return; | ||||||
|             cc.tree = function(key) { |             cc.tree = function (key) { | ||||||
|                 let index = key || 0; |                 let index = key || 0; | ||||||
|                 let treeNode = function(node) { |                 let treeNode = function (node) { | ||||||
|                     let nameStyle = |                     let nameStyle = | ||||||
|                         `color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`; |                         `color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`; | ||||||
|                     let propStyle = |                     let propStyle = | ||||||
| @@ -452,10 +452,10 @@ let app = new Vue({ | |||||||
|                 } |                 } | ||||||
|                 return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.'; |                 return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.'; | ||||||
|             } |             } | ||||||
|             cc.cat = function(key) { |             cc.cat = function (key) { | ||||||
|                 let index = 0; |                 let index = 0; | ||||||
|                 let target; |                 let target; | ||||||
|                 let sortId = function(node) { |                 let sortId = function (node) { | ||||||
|                     if (target) return; |                     if (target) return; | ||||||
|                     if (cc.js.isNumber(key)) { |                     if (cc.js.isNumber(key)) { | ||||||
|                         if (key === index++) { |                         if (key === index++) { | ||||||
| @@ -481,9 +481,9 @@ let app = new Vue({ | |||||||
|                 target['tempIndex'] = cc.js.isNumber(key) ? key : index; |                 target['tempIndex'] = cc.js.isNumber(key) ? key : index; | ||||||
|                 return target; |                 return target; | ||||||
|             } |             } | ||||||
|             cc.list = function(key) { |             cc.list = function (key) { | ||||||
|                 let targets = []; |                 let targets = []; | ||||||
|                 let step = function(node) { |                 let step = function (node) { | ||||||
|                     if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) { |                     if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) { | ||||||
|                         targets.push(node); |                         targets.push(node); | ||||||
|                     } |                     } | ||||||
| @@ -501,7 +501,7 @@ let app = new Vue({ | |||||||
|                     return targets; |                     return targets; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             cc.where = function(key) { |             cc.where = function (key) { | ||||||
|                 let target = key.name ? key : cc.cat(key); |                 let target = key.name ? key : cc.cat(key); | ||||||
|                 if (!target) { |                 if (!target) { | ||||||
|                     return null; |                     return null; | ||||||
| @@ -542,7 +542,7 @@ let app = new Vue({ | |||||||
|             // console.log(val); |             // console.log(val); | ||||||
|         } |         } | ||||||
|     }, |     }, | ||||||
|     created: function() { |     created: function () { | ||||||
|         this.checkVersion(); |         this.checkVersion(); | ||||||
|         document.body.insertBefore(document.getElementById('app'), document.body.firstChild); |         document.body.insertBefore(document.getElementById('app'), document.body.firstChild); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|     "name": "ccc-devtools", |     "name": "ccc-devtools", | ||||||
|     "version": "2.3.0", |     "version": "2.3.1", | ||||||
|     "author": "Next", |     "author": "Next", | ||||||
|     "repo": "https://github.com/potato47/ccc-devtools.git" |     "repo": "https://github.com/potato47/ccc-devtools.git" | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user