mirror of
				https://github.com/potato47/ccc-devtools.git
				synced 2025-10-31 03:15:50 +00:00 
			
		
		
		
	修复2.1以下版本重复点击节点报错问题
This commit is contained in:
		
							
								
								
									
										30
									
								
								js/app.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								js/app.js
									
									
									
									
									
								
							| @@ -89,9 +89,9 @@ let app = new Vue({ | ||||
|         cacheDataLoading: false | ||||
|     }, | ||||
|     methods: { | ||||
|         api: function(url, cb) { | ||||
|         api: function (url, cb) { | ||||
|             let xhr = new XMLHttpRequest(); | ||||
|             xhr.onreadystatechange = function() { | ||||
|             xhr.onreadystatechange = function () { | ||||
|                 if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) { | ||||
|                     let response = xhr.responseText; | ||||
|                     cb(JSON.parse(xhr.responseText)); | ||||
| @@ -100,7 +100,7 @@ let app = new Vue({ | ||||
|             xhr.open("GET", url, true); | ||||
|             xhr.send(); | ||||
|         }, | ||||
|         compareVersion: function(localVersion, remoteVersion) { | ||||
|         compareVersion: function (localVersion, remoteVersion) { | ||||
|             let vL = localVersion.split('.'); | ||||
|             let vR = remoteVersion.split('.'); | ||||
|             for (let i = 0; i < vL.length; ++i) { | ||||
| @@ -120,7 +120,7 @@ let app = new Vue({ | ||||
|                 return false; | ||||
|             } | ||||
|         }, | ||||
|         checkVersion: function() { | ||||
|         checkVersion: function () { | ||||
|             this.api('https://raw.githubusercontent.com/potato47/ccc-devtools/master/version.json', ( | ||||
|                 data) => { | ||||
|                 let remoteVersion = data.version; | ||||
| @@ -307,9 +307,9 @@ let app = new Vue({ | ||||
|         openDevMode() { | ||||
|             setTimeout(() => { | ||||
|                 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; | ||||
|                     }, function(value) { | ||||
|                     }, function (value) { | ||||
|  | ||||
|                     }, false, true); | ||||
|                 } | ||||
| @@ -358,7 +358,7 @@ let app = new Vue({ | ||||
|         }, | ||||
|         handleChangeStats() { | ||||
|             if (this.$data.isShowProfile) { | ||||
|                 let addStats = function(stats) { | ||||
|                 let addStats = function (stats) { | ||||
|                     stats.dom.style.position = 'relative'; | ||||
|                     stats.dom.style.float = 'right'; | ||||
|                     stats.dom.style.marginLeft = '10px'; | ||||
| @@ -417,9 +417,9 @@ let app = new Vue({ | ||||
|         }, | ||||
|         initConsoleUtil() { | ||||
|             if (cc.tree) return; | ||||
|             cc.tree = function(key) { | ||||
|             cc.tree = function (key) { | ||||
|                 let index = key || 0; | ||||
|                 let treeNode = function(node) { | ||||
|                 let treeNode = function (node) { | ||||
|                     let nameStyle = | ||||
|                         `color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`; | ||||
|                     let propStyle = | ||||
| @@ -452,10 +452,10 @@ let app = new Vue({ | ||||
|                 } | ||||
|                 return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.'; | ||||
|             } | ||||
|             cc.cat = function(key) { | ||||
|             cc.cat = function (key) { | ||||
|                 let index = 0; | ||||
|                 let target; | ||||
|                 let sortId = function(node) { | ||||
|                 let sortId = function (node) { | ||||
|                     if (target) return; | ||||
|                     if (cc.js.isNumber(key)) { | ||||
|                         if (key === index++) { | ||||
| @@ -481,9 +481,9 @@ let app = new Vue({ | ||||
|                 target['tempIndex'] = cc.js.isNumber(key) ? key : index; | ||||
|                 return target; | ||||
|             } | ||||
|             cc.list = function(key) { | ||||
|             cc.list = function (key) { | ||||
|                 let targets = []; | ||||
|                 let step = function(node) { | ||||
|                 let step = function (node) { | ||||
|                     if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) { | ||||
|                         targets.push(node); | ||||
|                     } | ||||
| @@ -501,7 +501,7 @@ let app = new Vue({ | ||||
|                     return targets; | ||||
|                 } | ||||
|             } | ||||
|             cc.where = function(key) { | ||||
|             cc.where = function (key) { | ||||
|                 let target = key.name ? key : cc.cat(key); | ||||
|                 if (!target) { | ||||
|                     return null; | ||||
| @@ -542,7 +542,7 @@ let app = new Vue({ | ||||
|             // console.log(val); | ||||
|         } | ||||
|     }, | ||||
|     created: function() { | ||||
|     created: function () { | ||||
|         this.checkVersion(); | ||||
|         document.body.insertBefore(document.getElementById('app'), document.body.firstChild); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user