大体思路 (五)
1. initProxy 渲染函数的作用域代理
  ==> es6 如果支持proxy (hasProxy) 就用proxy 不支持就用 defineProperty()
  proxy 和 defineProperty 区别?
  definedProperty 只能监听对象的属性 描述属性
  proxy 是一个构造函数 监听对象 支持拦截操作 代理obj对象对obj并不直接做处理。
  var obj = {name: 'max'}
  var peoxyobj = new Proxy(obj,{
    has: function(target,key){
      console.log('hahahhah')
    }
  })
  has 钩子函数 可以拦截proxyobj 判断对象是否具有某个属性时触发钩子函数
  has 可以拦截 with语句
  with 改变执行中的作用域
  console.log("name" in peoxyobj)
  with(obj){
    console.log(name) //== obj.name 将环境指向obj
  }
  with 不推荐使用 性能差
  ==> options.render && options.render._withStripped?
      getHeadler :
      hasHeadler ;
      vm._renderProxy = new Proxy(vm,h)
  ==>hasHeadler
  ==> alloweGlobals 检测是否为一些全局变量 或者是 render内置方法 _
  ==>getHeadler
2. initLifecycle 实例对象$children $parent 处理
  ==> 将当前实例添加到父实例的 $children属性中,并设置自身的$parent的属性指向父实例。
    abstrat // 抽象组件 1.不会出现在父级的路径上,2.不会参与dom渲染。
vue.js 代码如下
  1. // 大体思路 (五)
  2. // 本节内容:
  3. // 1. initProxy 渲染函数的作用域代理
  4. // ==> es6 如果支持proxy (hasProxy) 就用proxy 不支持就用 defineProperty()
  5. // proxy 和 defineProperty 区别?
  6. // definedProperty 只能监听对象的属性 描述属性
  7. // proxy 是一个构造函数 监听对象 支持拦截操作 代理obj对象对obj并不直接做处理。
  8. // var obj = {name: 'max'}
  9. // var peoxyobj = new Proxy(obj,{
  10. // has: function(target,key){
  11. // console.log('hahahhah')
  12. // }
  13. // })
  14. // has 钩子函数 可以拦截proxyobj 判断对象是否具有某个属性时触发钩子函数
  15. // has 可以拦截 with语句
  16. // with 改变执行中的作用域
  17. // console.log("name" in peoxyobj)
  18. // with(obj){
  19. // console.log(name) //== obj.name 将环境指向obj
  20. // }
  21. // with 不推荐使用 性能差
  22. // ==> options.render && options.render._withStripped?
  23. // getHeadler :
  24. // hasHeadler ;
  25. // vm._renderProxy = new Proxy(vm,h)
  26. // ==>hasHeadler
  27. // ==> alloweGlobals 检测是否为一些全局变量 或者是 render内置方法 _
  28. // ==>getHeadler
  29. // options.render 准备就绪了
  30. // 2. initLifecycle 实例对象$children $parent 处理
  31. // 将当前实例添加到父实例的 $children属性中,并设置自身的$parent的属性指向父实例。
  32. // abstrat // 抽象组件 1.不会出现在父级的路径上,2.不会参与dom渲染。
  33.  
  34. (function(global,factory){
  35. // 兼容 cmd
  36. typeof exports === 'object' && module !== 'undefined' ? module.exports = factory():
  37. // Amd
  38. typeof define === 'function' && define.amd ? define(factory) : global.Vue = factory();
  39. })(this,function(){
  40. var uip = 0;
  41. function warn(string){
  42. console.error('Vue Wran:' + string)
  43. }
  44. function warnNonpresent(target,key){
  45. warn('属性方法'+ key + '未在实例对象上定义,渲染功能正在尝试访问这个不存在的属性!')
  46. }
  47. function resolveConstructorOptions(Con){
  48. var options = Con.options;
  49. // 判断是否为vm的实例 或者是子类
  50. return options
  51. }
  52. var hasOwnPropeerty = Object.prototype.hasOwnProperty
  53. function hasOwn(obj , key){
  54. return hasOwnPropeerty.call(obj,key)
  55. }
  56. function makeMap(str, expectsLoweraseC){
  57. if(expectsLoweraseC){
  58. str = str.toLowerCase()
  59. }
  60. var map = Object.create(null)
  61. var list = str.split(',')
  62. for(var i = 0 ; i < list.length; i++){
  63. map[list[i]] = true
  64. }
  65. return function(key){
  66. return map[key]
  67.  
  68. }
  69. }
  70. var isbuiltInTag = makeMap('slot,component',true)
  71. var isHTMLTag = makeMap(
  72. 'html,body,base,head,link,meta,style,title,' +
  73. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  74. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  75. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  76. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  77. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  78. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  79. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  80. 'output,progress,select,textarea,' +
  81. 'details,dialog,menu,menuitem,summary,' +
  82. 'content,element,shadow,template,blockquote,iframe,tfoot'
  83. );
  84. var isSVG = makeMap(
  85. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  86. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  87. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  88. true
  89. );
  90. var ASSET_TYPES = [
  91. 'component',
  92. 'directive',
  93. 'filter'
  94. ];
  95.  
  96. var LIFECYCLE_HOOKS = [
  97. 'beforeCreate',
  98. 'created',
  99. 'beforeMount',
  100. 'mounted',
  101. 'beforeUpdate',
  102. 'updated',
  103. 'beforeDestroy',
  104. 'destroyed',
  105. 'activated',
  106. 'deactivated',
  107. 'errorCaptured'
  108. ];
  109.  
  110. var isReservedTag = function(key){
  111. return isHTMLTag(key) || isSVG(key)
  112. }
  113. function validataComponentName(key){
  114. //检测component 的自定义名称是否合格
  115. // 只能是字母开头或下划线,必须是字母开头
  116. if(!(/^[a-zA-Z][\w-]*$/g.test(key))){
  117. warn('组件的名称必须是字母或中横线,必须由字母开头')
  118. }
  119. // 1. 不能为内置对象,2.不能是html ,和avg的内部标签
  120. if( isbuiltInTag(key) || isReservedTag(key)){
  121. warn('不能为html标签或者avg的内部标签')
  122. }
  123. }
  124. function checkComonpents(child){
  125. for(var key in child.components){
  126. validataComponentName(key)
  127. }
  128. }
  129. // 配置对象
  130. var config = {
  131. // 自定义的策略
  132. optionMergeStrategies:{}
  133. }
  134. var strats = config.optionMergeStrategies
  135. strats.el = function(parent,child , key , vm){
  136.  
  137. if(!vm){
  138. warn('选项'+key+'只能在vue实例用使用')
  139. }
  140. return defaultStrat(parent,child , key , vm)
  141. }
  142. function mergeData(to,form){
  143. // 终极合并
  144. if(!form){
  145. return to
  146. }
  147. // 具体合并。
  148. }
  149. function mergeDataorFn(parentVal,childVal,vm){
  150. // 合并 parentVal childVal 都是函数
  151. if(!vm){
  152. if(!childVal){
  153. return parentVal
  154. }
  155. if(!parentVal){
  156. return childVal
  157. }
  158. return function mergeDataFn(parentVal,childVal,vm){//只是一个函数 什么样的情况下调用 加入响应式系统
  159. // 合并子组件对应的data 和 父组件对应的data
  160. return mergeData(
  161. typeof parentVal === 'function' ? parentVal.call(this,this) : parentVal, // -----忘记写
  162. typeof childVal === 'function' ? childVal.call(this,this): childVal) // -----忘记写
  163. }
  164. }else{ // vue实例
  165. return function mergeInstanceDataFn(parentVal,childVal,vm){//只是一个函数 什么样的情况下调用 加入响应式系统
  166. var InstanceData = typeof childVal === 'function' ? childVal.call(vm,vm): childVal; // -----忘记写
  167. var defaultData = typeof parentVal === 'function' ? parent.call(vm,vm): parentVal; // -----忘记写
  168. if(InstanceData){
  169. return mergeData(parentVal,childVal)
  170. }else{ // -----忘记写
  171. defaultData
  172. }
  173.  
  174. }
  175. }
  176. }
  177. strats.data = function(parent,child , key , vm){
  178. if(!vm){
  179. // console.log(typeof child === 'function')
  180. if(child && !(typeof child === 'function')){
  181. warn('data必须返回是一个function')
  182. }
  183. return mergeDataorFn(parent,child)
  184. }
  185. return mergeDataorFn(parent,child,vm)
  186. }
  187. // 生命周期策略的合并,值等于一个function 如果是有两个,放到一个数组里面。
  188. function mergeHook(parentVal,childVal,key,vm){
  189. // console.log(key)
  190. // console.log(parentVal.concat(childVal) )
  191. return childVal ? parentVal ? parentVal.concat(childVal):
  192. Array.isArray(childVal) ? childVal : [childVal] : parentVal
  193. }
  194. LIFECYCLE_HOOKS.forEach(function(key){
  195. strats[key] = mergeHook
  196. });
  197. // 检测是否为object
  198. function isPlainObject(obj){
  199. return Object.prototype.toString.call(obj) === '[object Object]'
  200. }
  201. function assetObjectType(obj){
  202. if(!isPlainObject(obj)){
  203. marn('选项的值'+obj+'无效:必须是一个对象的')
  204. }
  205. }
  206. // 对parent实现链式调用。
  207. function extend(to,form){
  208. for(key in form){
  209.  
  210. to[key] = form[key]
  211. }
  212. return to
  213. }
  214. // 实现Assets 的策略合并 conmponents filter diretive
  215. function mergeAssets(parentVal,childVal,key,vm){
  216. var parent = Object.create(parentVal || null) // 保证子类的每个值的指向都是一个新的object。否则回出现相互引用的现象。
  217. if(childVal){
  218. assetObjectType(childVal)
  219. return extend(parent,childVal)
  220. }
  221. return parent
  222. }
  223. ASSET_TYPES.forEach(function(key){
  224. strats[key+'s'] = mergeAssets
  225. })
  226. // 实现watch的策略和并,将相同的属性放到一个数组里面。
  227. strats.watch = function(parentVal,childVal , key , vm){
  228. if(!childVal){
  229. return Object.create(parentVal)
  230. }
  231. var res = {}
  232. res = extend(res,parentVal)
  233. for(var key in childVal){
  234. var parent = res[key]
  235. var child = childVal[key]
  236. res[key] = parent ? Array.isArray(parent) ? parent.concat(child) : [parent].concat(child) :
  237. Array.isArray(child) ? child : [child] ;
  238. }
  239. return res
  240. }
  241. // 实现props指令的合并策略
  242. strats.props = function(parentVal,childVal , key , vm){
  243. if(!childVal){
  244. return parentVal
  245. }
  246. var res = Object.create( null)
  247. extend(res,parentVal)
  248. if(childVal){
  249. extend(res,childVal)
  250. }
  251. return res
  252. }
  253. function defaultStrat(parent,child , key , vm){
  254. return child === undefined ? parent :child ;
  255. }
  256. var cmalizeRE = /-(\w)/g
  257. function camelize(val){
  258. return val.replace(cmalizeRE,function(c,m){
  259. return m ? m.toUpperCase(): ""
  260. })
  261. }
  262. function normalizeProps(options){
  263. var props = options.props
  264. if(!props){
  265. return
  266. }
  267. var i , val , name
  268. var res = {}
  269. if(Array.isArray(props)){
  270. i = props.length
  271. while(i--){
  272. val = props[i]
  273. if(toString.call(val) === '[object String]'){
  274. name = camelize(val)
  275. res[name] = {type: null}
  276. }else{
  277. warn('使用数组愈发时props成员' +val+ '必须时一个数组')
  278. }
  279.  
  280. }
  281. }else if(isPlainObject(props)){
  282. for(var key in props){
  283. val = props[key]
  284. name = camelize(key)
  285. res[name] = isPlainObject(val) ? val : {type: val}
  286. }
  287. }else {
  288. warn('选项props的值必须是一个对象或者是数组')
  289. }
  290. options.props = res
  291. }
  292. function mormalizeDirectives(options){
  293. var dir = options.directives
  294. var res = {}
  295. if(!dir){
  296. return
  297. }
  298. if(dir){
  299. for(var key in dir){
  300. var val = dir[key]
  301. var name = camelize(key)
  302. if(isPlainObject(val)){
  303. res[name] = val
  304. }
  305. if(toString.call(val) === '[object Function]'){
  306. res[name] = {
  307. bind: val,
  308. upata: val
  309. }
  310. }
  311. }
  312. }
  313. options.directives = res
  314.  
  315. }
  316. function mergeOptions(parent,child,vm){
  317. var options = {}
  318. // 检测是component 是否是合法的
  319. checkComonpents(child)
  320. // 规范props
  321. normalizeProps(child)
  322. // 规范 dirctives
  323. mormalizeDirectives(child)
  324.  
  325. // console.log(parent, child)
  326. for(key in parent){
  327. magerField(key)
  328. }
  329. for(key in child){
  330. if(!hasOwn(parent ,key)){ // parent 中循环过地方不进行循环
  331. magerField(key) // ----忘记写
  332. }
  333.  
  334. }
  335. // 默认合并策略
  336. function magerField(key){
  337. // 自定义策略 默认策略
  338. // console.log(key)
  339. var result = strats[key] || defaultStrat // ---忘记写
  340. options[key] = result(parent[key],child[key] , key , vm)
  341. }
  342. // console.log(options)
  343. return options
  344. }
  345.  
  346. var allowedGlobals = makeMap(
  347. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  348. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  349. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  350. 'require' // for Webpack/Browserify
  351. );
  352. function isNative(Ctor){
  353. return typeof Ctor !== undefined && /native code/.test(toString.call(Ctor))
  354. }
  355. var hasproxy = typeof Proxy !== undefined && isNative(Proxy)
  356. var hasHeadler = {
  357. has: function(target,key){
  358. var val = key in target
  359. // key 是否是全局对象 或者内置方法 _
  360. var isAllowed = allowedGlobals(key) || (typeof key === 'string' && key.charAt(0) === '_')
  361. if(!val && !isAllowed){
  362. warnNonpresent(target,key)
  363. }
  364. return val || !isAllowed
  365. }
  366. }
  367. var getHeadler = {
  368. get: function(target,key){
  369. if( typeof key === 'string' && !(key in target)){
  370. warnNonpresent(target,key)
  371. }
  372. return target[key]
  373. }
  374. }
  375.  
  376. // 数据代理
  377. function initProxy(vm){
  378. var options = vm.$options
  379. // 判断是否是es6 是否存在Proxy
  380. if(hasproxy){
  381. // 渲染函数拦截那些操作。 1. has 查询 2. get 或者
  382. var headler = options.render && options.render._withStripeed ?
  383. getHeadler:
  384. hasHeadler;
  385. vm._renderPorxy= new proxy(vm,headler)
  386. }else{
  387. // 如果不支es6 Proxy
  388. vm._renderPorxy = vm
  389. }
  390. }
  391.  
  392. // 初始化当前实例的$children 和$parent 的指向
  393. function initLifeCycle(vm){
  394. var options = vm.$options
  395. // 当前组件 父实例
  396. var parent = options.parent // 组件的实例对象
  397. // 是否抽象组件
  398. if(parent && !parent.abstrat){
  399. while(parent.$options.abstrat && parent.$parent){
  400. parent = parent.$options.parent
  401. }
  402. parent.$children.push(vm)
  403. }
  404. vm.$parent = parent
  405. vm.$root = parent ? parent.$root : vm;
  406.  
  407. vm.$children = [];
  408. vm.$refs = {};
  409.  
  410. vm._watcher = null;
  411. vm._inactive = null;
  412. vm._directInactive = false;
  413. vm._isMounted = false; // 是否挂载
  414. vm._isDestroyed = false; // 是否销毁
  415. vm._isBeingDestroyed = false; // 是否正在销毁
  416.  
  417. }
  418. function initMinxin(options){
  419. Vue.prototype._init = function(options){
  420. var vm = this
  421. // 记录生成的vue实例对象
  422. vm._uip = uip++ // //-------忘记写
  423. //合并选项
  424. vm.$options =mergeOptions(resolveConstructorOptions(vm.constructor),options,vm)
  425. // // 初始化数值代理
  426. initProxy(vm)
  427. // 初始化当前实例的$children 和$parent 的指向
  428. initLifeCycle(vm)
  429. }
  430. }
  431. function Vue(options){
  432. // 安全机制
  433. if(!(this instanceof Vue)){ //-------忘记写
  434. warn('Vue是一个构造函数,必须是由new关键字调用')
  435. }
  436. this._init(options)
  437. }
  438. initMinxin() // 初始化选项1: 规范 2: 合并策略。
  439. Vue.options = {
  440. components: {
  441. transtions: {},
  442. keepAlive:{},
  443. solt:{},
  444. transtionsGroup:{}
  445. },
  446. directives:{},
  447. _bash: Vue
  448. }
  449. function initExend(Vue){
  450. Vue.extend = function(extendOptions){
  451. extendOptions = extendOptions || {} // -----忘记写
  452. var Super = this
  453. var Child = function VueComponent(options) {
  454. this._init(options)
  455. }
  456. Child.prototype = Object.create(Super.prototype)
  457. Child.prototype.constructor = Child // 改变constructor 的指向
  458. Child.options = mergeOptions(Super.options,extendOptions)
  459. // 子类继承父类的静态方法。
  460. Child.extend = Vue.extend
  461. // console.log(new Child({}))
  462. return Child
  463. }
  464. }
  465. initExend(Vue)
  466. return Vue
  467. })

html代码如下

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>第四课</title>
  8. </head>
  9. <body>
  10. <div id="app">
  11. <huml></huml>
  12. </div>
  13. <script src="vue.js"></script>
  14. <!-- <script src="vue2.5.1.js"></script> -->
  15. <script type="text/javascript">
  16. var componentA = {
  17. el: "#app"
  18. }
  19. var vm = new Vue({
  20. el:"#app",
  21. data: {
  22. message: "hello Vue",
  23. key: "wodow"
  24. },
  25. components:{
  26. humle: componentA
  27. }
  28.  
  29. })
  30. // console.log(Vue)
  31. var Parent = Vue.extend({
  32. data: function() {},
  33. props: {
  34. 'rrr': 1
  35. },
  36. components:{
  37. huml: componentA
  38. },
  39. created : function(){
  40.  
  41. },
  42. watch: {
  43. test: function(){}
  44. }
  45. })
  46. var Child = Parent.extend({
  47. components:{
  48. humlt: componentA
  49. },
  50. created: function(){
  51.  
  52. },
  53. props: {
  54. 'ddd': 3,
  55. "dcdc-vfv": Number
  56. },
  57. directives: {
  58. test: {
  59. bind: function(){}
  60. },
  61. test2: function(){}
  62. },
  63. watch: {
  64. aa: function(){},
  65. test: function(){}
  66. }
  67. });
  68. console.log(vm)
  69. console.log (Parent.options)
  70. console.log(Child.options)
  71. </script>
  72. </body>
  73. </html>

【js】 vue 2.5.1 源码学习(六) initProxy initLifeCycle 渲染函数的作用域代理的更多相关文章

  1. 【js】vue 2.5.1 源码学习 (四) 钩子函数 资源选项 watch 的合并策略

    大体思路 (三)    1.钩子函数 自定义策略       LIFECYCLE_HOOKS= []      created = [function(){} , function(){}] 组装方法 ...

  2. 如何实现全屏遮罩(附Vue.extend和el-message源码学习)

    [Vue]如何实现全屏遮罩(附Vue.extend和el-message源码学习) 在做个人项目的时候需要做一个类似于电子相册浏览的控件,实现过程中首先要实现全局遮罩,结合自己的思路并阅读了(饿了么) ...

  3. Hadoop源码学习笔记(2) ——进入main函数打印包信息

    Hadoop源码学习笔记(2) ——进入main函数打印包信息 找到了main函数,也建立了快速启动的方法,然后我们就进去看一看. 进入NameNode和DataNode的主函数后,发现形式差不多: ...

  4. 【js】 vue 2.5.1 源码学习(十二)模板编译

    大体思路(十) 本节内容: 1. baseoptions 参数分析 2. options 参数分析 3. parse 编译器 4. parseHTNL 函数解析 // parse 解析 parser- ...

  5. 【js】vue 2.5.1 源码学习 (十一) 模板编译compileToFunctions渲染函数

    大体思路(九) 本节内容: 1. compileToFunctions定位 1. compileToFunctions定位 ==> createCompiler = createCompiler ...

  6. 【js】vue 2.5.1 源码学习 (十) $mount 挂载函数的实现

    大体思路(九) 本节内容: 1. $mount 挂载函数的实现. // 将Vue.prototype.$mount 缓存下来 ==>mountComponet(this,el) { // 组建挂 ...

  7. 【js】vue 2.5.1 源码学习 (九) 响应数组对象的变

    大体思路(八) 本节内容: 1.Observe 如何响应数组的变化 代理原型 数组变异方法 shell cacheArrProto methods 新添加的数组需要加到显示系统里面,拦截 push等的 ...

  8. 【js】Vue 2.5.1 源码学习 (八)响应式入口observe

    大体思路(七) 本节内容: deps 依赖收集的数组对象 => Dep 构造函数 /** ==> observe() * var ob * ==> if --isObject * = ...

  9. 【js】vue 2.5.1 源码学习 (七) 初始化之 initState 响应式系统基本思路

    大体思路(六) 本节内容: 一.生命周期的钩子函数的实现 ==> callHook(vm , 'beforeCreate') beforeCreate 实例创建之后 事件数据还未创建 二.初始化 ...

随机推荐

  1. UE4 Pak 相关知识总结

    转载自:https://arcecho.github.io/2017/07/02/UE4-Pak-%E7%9B%B8%E5%85%B3%E7%9F%A5%E8%AF%86%E6%80%BB%E7%BB ...

  2. 【JZOJ4929】【NOIP2017提高组模拟12.18】B

    题目描述 在两个n*m的网格上染色,每个网格中被染色的格子必须是一个四联通块(没有任何格子被染色也可以),四联通块是指所有染了色的格子可以通过网格的边联通,现在给出哪些格子在两个网格上都被染色了,保证 ...

  3. utf8mb4 使用注意

    数据库的表的定义如果是utf8mb4的富文本时,关联的字段必须指定为非utf8,否则 跟其他的表关联的时候,会非常慢,以至于索引都不能使用. 也就是必须的字段才可以使用这个 utf8mb4 ,否则检索 ...

  4. phonegap支付宝2.0移动快捷支付插件IOS版

    坑爹的支付宝,一两年都没有更新sdk了,这两天突然更新sdk,而且更新的变化特别大,所以只能对之前的支付宝快捷支付插件重新写了一遍. 这样既顺应了支付宝的更新,同时也支持了ios8. 废话少说,集成过 ...

  5. 比较全面的一个PHP缓存类解析

    转自:http://www.blhere.com/1164.html 一.引论 PHP,一门最近几年兴起的web设计脚本语言,由于它的强大和可伸缩性,近几年来得到长足的发展,php相比传统的asp网站 ...

  6. 【JZOJ4884】【NOIP2016提高A组集训第12场11.10】图的半径

    题目描述 mhy12345学习了树的直径,于是开始研究图的半径,具体来说,我们需要在图中选定一个地方作为中心,其中这个中心有可能在路径上. 而这个中心的选址需要能够使得所有节点达到这个中心的最短路里面 ...

  7. 开窗函数over()中partition by关键字解析

    partition  by关键字是分析性函数的一部分,它和聚合函数不同的地方在于它能返回一个分组中的多条记录,而聚合函数一般只有一条反映统计值的记录,partition  by用于给结果集分组,如果没 ...

  8. MaxCompute 图计算用户手册(下)

    示例程序 强连通分量 在有向图中,如果从任意一个顶点出发,都能通过图中的边到达图中的每一个顶点,则称之为强连通图.一张有向图的顶点数极大的强连通子图称为强连通分量.此算法示例基于 parallel C ...

  9. 新xcode的literal syntax是什么

    New Objective-C Literal Syntax for NSArray, NSDictionary 是以@字符开始的方式简单地创建数组.字典.NSNumber常量. 代码如下: NSNu ...

  10. oralce CUBE

    select id,area,stu_type,sum(score) score from students group by cube(id,area,stu_type) order by id,a ...