vuejs-rails 2.2.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +16 -4
- data/lib/vuejs-rails.rb +9 -0
- data/lib/vuejs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/{vue-resource.js → dist/vue-resource.js} +28 -12
- data/vendor/assets/javascripts/dist/vue-resource.min.js +7 -0
- data/vendor/assets/javascripts/{vue-router.js → dist/vue-router.js} +448 -264
- data/vendor/assets/javascripts/dist/vue-router.min.js +6 -0
- data/vendor/assets/javascripts/{vue.js → dist/vue.js} +1243 -794
- data/vendor/assets/javascripts/dist/vue.min.js +8 -0
- data/vendor/assets/javascripts/{vuex.js → dist/vuex.js} +6 -8
- data/vendor/assets/javascripts/dist/vuex.min.js +6 -0
- data/vendor/assets/javascripts/vue-resource.js.erb +1 -0
- data/vendor/assets/javascripts/vue-router.js.erb +1 -0
- data/vendor/assets/javascripts/vue.js.erb +1 -0
- data/vendor/assets/javascripts/vuex.js.erb +1 -0
- metadata +15 -7
@@ -0,0 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
* vue-router v2.5.2
|
3
|
+
* (c) 2017 Evan You
|
4
|
+
* @license MIT
|
5
|
+
*/
|
6
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function t(t,e){}function e(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}function n(t,e,n){void 0===e&&(e={});var o,i=n||r;try{o=i(t||"")}catch(t){o={}}for(var a in e){var u=e[a];o[a]=Array.isArray(u)?u.slice():u}return o}function r(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=$t(n.shift()),o=n.length>0?$t(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function o(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return _t(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(_t(e)):r.push(_t(e)+"="+_t(t)))}),r.join("&")}return _t(e)+"="+_t(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function i(t,e,n,r){var o=r&&r.options.stringifyQuery,i={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:u(e,o),matched:t?a(t):[]};return n&&(i.redirectedFrom=u(n,o)),Object.freeze(i)}function a(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function u(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var i=t.hash;void 0===i&&(i="");var a=e||o;return(n||"/")+a(r)+i}function c(t,e){return e===qt?t===e:!!e&&(t.path&&e.path?t.path.replace(St,"")===e.path.replace(St,"")&&t.hash===e.hash&&s(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&s(t.query,e.query)&&s(t.params,e.params)))}function s(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){return String(t[n])===String(e[n])})}function p(t,e){return 0===t.path.replace(St,"/").indexOf(e.path.replace(St,"/"))&&(!e.hash||t.hash===e.hash)&&f(t.query,e.query)}function f(t,e){for(var n in e)if(!(n in t))return!1;return!0}function h(t){if(!(t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function l(t){if(t)for(var e,n=0;n<t.length;n++){if(e=t[n],"a"===e.tag)return e;if(e.children&&(e=l(e.children)))return e}}function d(t){if(!d.installed){d.installed=!0,Rt=t,Object.defineProperty(t.prototype,"$router",{get:function(){return this.$root._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this.$root._route}});var e=function(t){return void 0!==t},n=function(t,n){var r=t.$options._parentVnode;e(r)&&e(r=r.data)&&e(r=r.registerRouteInstance)&&r(t,n)};t.mixin({beforeCreate:function(){e(this.$options.router)&&(this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current)),n(this,this)},destroyed:function(){n(this)}}),t.component("router-view",Ct),t.component("router-link",Ut);var r=t.config.optionMergeStrategies;r.beforeRouteEnter=r.beforeRouteLeave=r.created}}function y(t,e,n){var r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;var o=e.split("/");n&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var u=i[a];".."===u?o.pop():"."!==u&&o.push(u)}return""!==o[0]&&o.unshift(""),o.join("/")}function v(t){var e="",n="",r=t.indexOf("#");r>=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}function m(t){return t.replace(/\/\//g,"/")}function g(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=Kt.exec(t));){var c=n[0],s=n[1],p=n.index;if(a+=t.slice(i,p),i=p+c.length,s)a+=s[1];else{var f=t[i],h=n[2],l=n[3],d=n[4],y=n[5],v=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=h&&null!=f&&f!==h,w="+"===v||"*"===v,b="?"===v||"*"===v,x=n[2]||u,k=d||y;r.push({name:l||o++,prefix:h||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!m,pattern:k?O(k):m?".*":"[^"+E(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function w(t,e){return k(g(t,e))}function b(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function x(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function k(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,r){for(var o="",i=n||{},a=r||{},u=a.pretty?b:encodeURIComponent,c=0;c<t.length;c++){var s=t[c];if("string"!=typeof s){var p,f=i[s.name];if(null==f){if(s.optional){s.partial&&(o+=s.prefix);continue}throw new TypeError('Expected "'+s.name+'" to be defined')}if(Vt(f)){if(!s.repeat)throw new TypeError('Expected "'+s.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(s.optional)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var h=0;h<f.length;h++){if(p=u(f[h]),!e[c].test(p))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'", but received `'+JSON.stringify(p)+"`");o+=(0===h?s.prefix:s.delimiter)+p}}else{if(p=s.asterisk?x(f):u(f),!e[c].test(p))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but received "'+p+'"');o+=s.prefix+p}}else o+=s}return o}}function E(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function O(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function R(t,e){return t.keys=e,t}function C(t){return t.sensitive?"":"i"}function A(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return R(t,e)}function j(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push($(t[o],e,n).source);var i=new RegExp("(?:"+r.join("|")+")",C(n));return R(i,e)}function T(t,e,n){return _(g(t,n),e,n)}function _(t,e,n){Vt(e)||(n=e||n,e=[]),n=n||{};for(var r=n.strict,o=n.end!==!1,i="",a=0;a<t.length;a++){var u=t[a];if("string"==typeof u)i+=E(u);else{var c=E(u.prefix),s="(?:"+u.pattern+")";e.push(u),u.repeat&&(s+="(?:"+c+s+")*"),s=u.optional?u.partial?c+"("+s+")?":"(?:"+c+"("+s+"))?":c+"("+s+")",i+=s}}var p=E(n.delimiter||"/"),f=i.slice(-p.length)===p;return r||(i=(f?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":r&&f?"":"(?="+p+"|$)",R(new RegExp("^"+i,C(n)),e)}function $(t,e,n){return Vt(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?A(t,e):Vt(t)?j(t,e,n):T(t,e,n)}function S(t,e,n){try{var r=Jt[t]||(Jt[t]=zt.compile(t));return r(e||{},{pretty:!0})}catch(t){return""}}function q(t,e,n,r){var o=e||[],i=n||Object.create(null),a=r||Object.create(null);t.forEach(function(t){L(o,i,a,t)});for(var u=0,c=o.length;u<c;u++)"*"===o[u]&&(o.push(o.splice(u,1)[0]),c--,u--);return{pathList:o,pathMap:i,nameMap:a}}function L(t,e,n,r,o,i){var a=r.path,u=r.name,c=U(a,o),s={path:c,regex:P(c),components:r.components||{default:r.component},instances:{},name:u,parent:o,matchAs:i,redirect:r.redirect,beforeEnter:r.beforeEnter,meta:r.meta||{},props:null==r.props?{}:r.components?r.props:{default:r.props}};if(r.children&&r.children.forEach(function(r){var o=i?m(i+"/"+r.path):void 0;L(t,e,n,r,s,o)}),void 0!==r.alias)if(Array.isArray(r.alias))r.alias.forEach(function(i){var a={path:i,children:r.children};L(t,e,n,a,o,s.path)});else{var p={path:r.alias,children:r.children};L(t,e,n,p,o,s.path)}e[s.path]||(t.push(s.path),e[s.path]=s),u&&(n[u]||(n[u]=s))}function P(t){var e=zt(t);return e}function U(t,e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:m(e.path+"/"+t)}function H(t,e,r,o){var i="string"==typeof t?{path:t}:t;if(i.name||i._normalized)return i;if(!i.path&&i.params&&e){i=I({},i),i._normalized=!0;var a=I(I({},e.params),i.params);if(e.name)i.name=e.name,i.params=a;else if(e.matched){var u=e.matched[e.matched.length-1].path;i.path=S(u,a,"path "+e.path)}return i}var c=v(i.path||""),s=e&&e.path||"/",p=c.path?y(c.path,s,r||i.append):s,f=n(c.query,i.query,o&&o.options.parseQuery),h=i.hash||c.hash;return h&&"#"!==h.charAt(0)&&(h="#"+h),{_normalized:!0,path:p,query:f,hash:h}}function I(t,e){for(var n in e)t[n]=e[n];return t}function V(t,e){function n(t){q(t,s,p,f)}function r(t,n,r){var o=H(t,n,!1,e),i=o.name;if(i){var a=f[i],c=a.regex.keys.filter(function(t){return!t.optional}).map(function(t){return t.name});if("object"!=typeof o.params&&(o.params={}),n&&"object"==typeof n.params)for(var h in n.params)!(h in o.params)&&c.indexOf(h)>-1&&(o.params[h]=n.params[h]);if(a)return o.path=S(a.path,o.params,'named route "'+i+'"'),u(a,o,r)}else if(o.path){o.params={};for(var l=0;l<s.length;l++){var d=s[l],y=p[d];if(z(y.regex,o.path,o.params))return u(y,o,r)}}return u(null,o)}function o(t,n){var o=t.redirect,a="function"==typeof o?o(i(t,n,null,e)):o;if("string"==typeof a&&(a={path:a}),!a||"object"!=typeof a)return u(null,n);var c=a,s=c.name,p=c.path,h=n.query,l=n.hash,d=n.params;if(h=c.hasOwnProperty("query")?c.query:h,l=c.hasOwnProperty("hash")?c.hash:l,d=c.hasOwnProperty("params")?c.params:d,s){f[s];return r({_normalized:!0,name:s,query:h,hash:l,params:d},void 0,n)}if(p){var y=M(p,t),v=S(y,d,'redirect route with path "'+y+'"');return r({_normalized:!0,path:v,query:h,hash:l},void 0,n)}return u(null,n)}function a(t,e,n){var o=S(n,e.params,'aliased route with path "'+n+'"'),i=r({_normalized:!0,path:o});if(i){var a=i.matched,c=a[a.length-1];return e.params=i.params,u(c,e)}return u(null,e)}function u(t,n,r){return t&&t.redirect?o(t,r||n):t&&t.matchAs?a(t,n,t.matchAs):i(t,n,r,e)}var c=q(t),s=c.pathList,p=c.pathMap,f=c.nameMap;return{match:r,addRoutes:n}}function z(t,e,n){var r=e.match(t);if(!r)return!1;if(!n)return!0;for(var o=1,i=r.length;o<i;++o){var a=t.keys[o-1],u="string"==typeof r[o]?decodeURIComponent(r[o]):r[o];a&&(n[a.name]=u)}return!0}function M(t,e){return y(t,e.parent?e.parent.path:"/",!0)}function B(){window.addEventListener("popstate",function(t){D(),t.state&&t.state.key&&G(t.state.key)})}function F(t,e,n,r){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick(function(){var t=K(),i=o(e,n,r?t:null);if(i){var a="object"==typeof i;if(a&&"string"==typeof i.selector){var u=document.querySelector(i.selector);u?t=J(u):N(i)&&(t=Q(i))}else a&&N(i)&&(t=Q(i));t&&window.scrollTo(t.x,t.y)}})}}function D(){var t=W();t&&(Nt[t]={x:window.pageXOffset,y:window.pageYOffset})}function K(){var t=W();if(t)return Nt[t]}function J(t){var e=document.documentElement,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left,y:r.top-n.top}}function N(t){return X(t.x)||X(t.y)}function Q(t){return{x:X(t.x)?t.x:window.pageXOffset,y:X(t.y)?t.y:window.pageYOffset}}function X(t){return"number"==typeof t}function Y(){return Xt.now().toFixed(3)}function W(){return Yt}function G(t){Yt=t}function Z(t,e){D();var n=window.history;try{e?n.replaceState({key:Yt},"",t):(Yt=Y(),n.pushState({key:Yt},"",t))}catch(n){window.location[e?"replace":"assign"](t)}}function tt(t){Z(t,!0)}function et(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],function(){r(o+1)}):r(o+1)};r(0)}function nt(t){if(!t)if(Ht){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function rt(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{updated:e.slice(0,n),activated:e.slice(n),deactivated:t.slice(n)}}function ot(t,e,n,r){var o=lt(t,function(t,r,o,i){var a=it(t,e);if(a)return Array.isArray(a)?a.map(function(t){return n(t,r,o,i)}):n(a,r,o,i)});return dt(r?o.reverse():o)}function it(t,e){return"function"!=typeof t&&(t=Rt.extend(t)),t.options[e]}function at(t){return ot(t,"beforeRouteLeave",ct,!0)}function ut(t){return ot(t,"beforeRouteUpdate",ct)}function ct(t,e){if(e)return function(){return t.apply(e,arguments)}}function st(t,e,n){return ot(t,"beforeRouteEnter",function(t,r,o,i){return pt(t,o,i,e,n)})}function pt(t,e,n,r,o){return function(i,a,u){return t(i,a,function(t){u(t),"function"==typeof t&&r.push(function(){ft(t,e.instances,n,o)})})}}function ft(t,e,n,r){e[n]?t(e[n]):r()&&setTimeout(function(){ft(t,e,n,r)},16)}function ht(t){return function(e,n,r){var o=!1,i=0,a=null;lt(t,function(t,e,n,u){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var c,s=yt(function(e){t.resolved="function"==typeof e?e:Rt.extend(e),n.components[u]=e,i--,i<=0&&r()}),p=yt(function(t){var e="Failed to resolve async component "+u+": "+t;a||(a=vt(t)?t:new Error(e),r(a))});try{c=t(s,p)}catch(t){p(t)}if(c)if("function"==typeof c.then)c.then(s,p);else{var f=c.component;f&&"function"==typeof f.then&&f.then(s,p)}}}),o||r()}}function lt(t,e){return dt(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function dt(t){return Array.prototype.concat.apply([],t)}function yt(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}function vt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function mt(t){var e=window.location.pathname;return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}function gt(t){var e=mt(t);if(!/^\/#/.test(e))return window.location.replace(m(t+"/#"+e)),!0}function wt(){var t=bt();return"/"===t.charAt(0)||(kt("/"+t),!1)}function bt(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.slice(e+1)}function xt(t){window.location.hash=t}function kt(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)}function Et(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function Ot(t,e,n){var r="hash"===n?"#"+e:e;return t?m(t+"/"+r):r}var Rt,Ct={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,n){var r=n.props,o=n.children,i=n.parent,a=n.data;a.routerView=!0;for(var u=i.$createElement,c=r.name,s=i.$route,p=i._routerViewCache||(i._routerViewCache={}),f=0,h=!1;i;)i.$vnode&&i.$vnode.data.routerView&&f++,i._inactive&&(h=!0),i=i.$parent;if(a.routerViewDepth=f,h)return u(p[c],a,o);var l=s.matched[f];if(!l)return p[c]=null,u();var d=p[c]=l.components[c];return a.registerRouteInstance=function(t,e){l.instances[c]!==t&&(l.instances[c]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){l.instances[c]=e.componentInstance},a.props=e(s,l.props&&l.props[c]),u(d,a,o)}},At=/[!'()*]/g,jt=function(t){return"%"+t.charCodeAt(0).toString(16)},Tt=/%2C/g,_t=function(t){return encodeURIComponent(t).replace(At,jt).replace(Tt,",")},$t=decodeURIComponent,St=/\/?$/,qt=i(null,{path:"/"}),Lt=[String,Object],Pt=[String,Array],Ut={name:"router-link",props:{to:{type:Lt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Pt,default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),a=o.location,u=o.route,s=o.href,f={},d=n.options.linkActiveClass,y=n.options.linkExactActiveClass,v=null==d?"router-link-active":d,m=null==y?"router-link-exact-active":y,g=null==this.activeClass?v:this.activeClass,w=null==this.exactActiveClass?m:this.exactActiveClass,b=a.path?i(null,a,null,n):u;f[w]=c(r,b),f[g]=this.exact?f[w]:p(r,b);var x=function(t){h(t)&&(e.replace?n.replace(a):n.push(a))},k={click:h};Array.isArray(this.event)?this.event.forEach(function(t){k[t]=x}):k[this.event]=x;var E={class:f};if("a"===this.tag)E.on=k,E.attrs={href:s};else{var O=l(this.$slots.default);if(O){O.isStatic=!1;var R=Rt.util.extend,C=O.data=R({},O.data);C.on=k;var A=O.data.attrs=R({},O.data.attrs);A.href=s}else E.on=k}return t(this.tag,E,this.$slots.default)}},Ht="undefined"!=typeof window,It=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},Vt=It,zt=$,Mt=g,Bt=w,Ft=k,Dt=_,Kt=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");zt.parse=Mt,zt.compile=Bt,zt.tokensToFunction=Ft,zt.tokensToRegExp=Dt;var Jt=Object.create(null),Nt=Object.create(null),Qt=Ht&&function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)}(),Xt=Ht&&window.performance&&window.performance.now?window.performance:Date,Yt=Y(),Wt=function(t,e){this.router=t,this.base=nt(e),this.current=qt,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};Wt.prototype.listen=function(t){this.cb=t},Wt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Wt.prototype.onError=function(t){this.errorCbs.push(t)},Wt.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach(function(t){t(o)}))},function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach(function(e){e(t)}))})},Wt.prototype.confirmTransition=function(e,n,r){var o=this,i=this.current,a=function(e){vt(e)&&(o.errorCbs.length?o.errorCbs.forEach(function(t){t(e)}):(t(!1,"uncaught error during route navigation:"),console.error(e))),r&&r(e)};if(c(e,i)&&e.matched.length===i.matched.length)return this.ensureURL(),a();var u=rt(this.current.matched,e.matched),s=u.updated,p=u.deactivated,f=u.activated,h=[].concat(at(p),this.router.beforeHooks,ut(s),f.map(function(t){return t.beforeEnter}),ht(f));this.pending=e;var l=function(t,n){if(o.pending!==e)return a();try{t(e,i,function(t){t===!1||vt(t)?(o.ensureURL(!0),a(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(a(),"object"==typeof t&&t.replace?o.replace(t):o.push(t)):n(t)})}catch(t){a(t)}};et(h,l,function(){var t=[],r=function(){return o.current===e},i=st(f,t,r),u=i.concat(o.router.resolveHooks);et(u,l,function(){return o.pending!==e?a():(o.pending=null,n(e),void(o.router.app&&o.router.app.$nextTick(function(){t.forEach(function(t){t()})})))})})},Wt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var Gt=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior;o&&B(),window.addEventListener("popstate",function(t){r.transitionTo(mt(r.base),function(t){o&&F(e,t,r.current,!0)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){Z(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){tt(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(mt(this.base)!==this.current.fullPath){var e=m(this.base+this.current.fullPath);t?Z(e):tt(e)}},e.prototype.getCurrentLocation=function(){return mt(this.base)},e}(Wt),Zt=function(t){function e(e,n,r){t.call(this,e,n),r&>(this.base)||wt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){wt()&&t.transitionTo(bt(),function(t){kt(t.fullPath)})})},e.prototype.push=function(t,e,n){this.transitionTo(t,function(t){xt(t.fullPath),e&&e(t)},n)},e.prototype.replace=function(t,e,n){this.transitionTo(t,function(t){kt(t.fullPath),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;bt()!==e&&(t?xt(e):kt(e))},e.prototype.getCurrentLocation=function(){return bt()},e}(Wt),te=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Wt),ee=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=V(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Qt,this.fallback&&(e="hash"),Ht||(e="abstract"),this.mode=e,e){case"history":this.history=new Gt(this,t.base);break;case"hash":this.history=new Zt(this,t.base,this.fallback);break;case"abstract":this.history=new te(this,t.base)}},ne={currentRoute:{}};return ee.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},ne.currentRoute.get=function(){return this.history&&this.history.current},ee.prototype.init=function(t){var e=this;if(this.apps.push(t),!this.app){this.app=t;var n=this.history;if(n instanceof Gt)n.transitionTo(n.getCurrentLocation());else if(n instanceof Zt){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},ee.prototype.beforeEach=function(t){return Et(this.beforeHooks,t)},ee.prototype.beforeResolve=function(t){return Et(this.resolveHooks,t)},ee.prototype.afterEach=function(t){return Et(this.afterHooks,t)},ee.prototype.onReady=function(t,e){this.history.onReady(t,e)},ee.prototype.onError=function(t){this.history.onError(t)},ee.prototype.push=function(t,e,n){this.history.push(t,e,n)},ee.prototype.replace=function(t,e,n){this.history.replace(t,e,n)},ee.prototype.go=function(t){this.history.go(t)},ee.prototype.back=function(){this.go(-1)},ee.prototype.forward=function(){this.go(1)},ee.prototype.getMatchedComponents=function(t){var e=t?this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},ee.prototype.resolve=function(t,e,n){var r=H(t,e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath,a=this.history.base,u=Ot(a,i,this.mode);return{location:r,route:o,href:u,normalizedTo:r,resolved:o}},ee.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==qt&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ee.prototype,ne),ee.install=d,ee.version="2.5.2",Ht&&window.Vue&&window.Vue.use(ee),ee});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Vue.js v2.2
|
2
|
+
* Vue.js v2.3.2
|
3
3
|
* (c) 2014-2017 Evan You
|
4
4
|
* Released under the MIT License.
|
5
5
|
*/
|
@@ -11,10 +11,54 @@
|
|
11
11
|
|
12
12
|
/* */
|
13
13
|
|
14
|
+
// these helpers produces better vm code in JS engines due to their
|
15
|
+
// explicitness and function inlining
|
16
|
+
function isUndef (v) {
|
17
|
+
return v === undefined || v === null
|
18
|
+
}
|
19
|
+
|
20
|
+
function isDef (v) {
|
21
|
+
return v !== undefined && v !== null
|
22
|
+
}
|
23
|
+
|
24
|
+
function isTrue (v) {
|
25
|
+
return v === true
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Check if value is primitive
|
30
|
+
*/
|
31
|
+
function isPrimitive (value) {
|
32
|
+
return typeof value === 'string' || typeof value === 'number'
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Quick object check - this is primarily used to tell
|
37
|
+
* Objects from primitive values when we know the value
|
38
|
+
* is a JSON-compliant type.
|
39
|
+
*/
|
40
|
+
function isObject (obj) {
|
41
|
+
return obj !== null && typeof obj === 'object'
|
42
|
+
}
|
43
|
+
|
44
|
+
var _toString = Object.prototype.toString;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Strict object type check. Only returns true
|
48
|
+
* for plain JavaScript objects.
|
49
|
+
*/
|
50
|
+
function isPlainObject (obj) {
|
51
|
+
return _toString.call(obj) === '[object Object]'
|
52
|
+
}
|
53
|
+
|
54
|
+
function isRegExp (v) {
|
55
|
+
return _toString.call(v) === '[object RegExp]'
|
56
|
+
}
|
57
|
+
|
14
58
|
/**
|
15
59
|
* Convert a value to a string that is actually rendered.
|
16
60
|
*/
|
17
|
-
function
|
61
|
+
function toString (val) {
|
18
62
|
return val == null
|
19
63
|
? ''
|
20
64
|
: typeof val === 'object'
|
@@ -74,13 +118,6 @@ function hasOwn (obj, key) {
|
|
74
118
|
return hasOwnProperty.call(obj, key)
|
75
119
|
}
|
76
120
|
|
77
|
-
/**
|
78
|
-
* Check if value is primitive
|
79
|
-
*/
|
80
|
-
function isPrimitive (value) {
|
81
|
-
return typeof value === 'string' || typeof value === 'number'
|
82
|
-
}
|
83
|
-
|
84
121
|
/**
|
85
122
|
* Create a cached version of a pure function.
|
86
123
|
*/
|
@@ -158,25 +195,6 @@ function extend (to, _from) {
|
|
158
195
|
return to
|
159
196
|
}
|
160
197
|
|
161
|
-
/**
|
162
|
-
* Quick object check - this is primarily used to tell
|
163
|
-
* Objects from primitive values when we know the value
|
164
|
-
* is a JSON-compliant type.
|
165
|
-
*/
|
166
|
-
function isObject (obj) {
|
167
|
-
return obj !== null && typeof obj === 'object'
|
168
|
-
}
|
169
|
-
|
170
|
-
/**
|
171
|
-
* Strict object type check. Only returns true
|
172
|
-
* for plain JavaScript objects.
|
173
|
-
*/
|
174
|
-
var toString = Object.prototype.toString;
|
175
|
-
var OBJECT_STRING = '[object Object]';
|
176
|
-
function isPlainObject (obj) {
|
177
|
-
return toString.call(obj) === OBJECT_STRING
|
178
|
-
}
|
179
|
-
|
180
198
|
/**
|
181
199
|
* Merge an Array of Objects into a single Object.
|
182
200
|
*/
|
@@ -222,7 +240,12 @@ function looseEqual (a, b) {
|
|
222
240
|
var isObjectA = isObject(a);
|
223
241
|
var isObjectB = isObject(b);
|
224
242
|
if (isObjectA && isObjectB) {
|
225
|
-
|
243
|
+
try {
|
244
|
+
return JSON.stringify(a) === JSON.stringify(b)
|
245
|
+
} catch (e) {
|
246
|
+
// possible circular reference
|
247
|
+
return a === b
|
248
|
+
}
|
226
249
|
} else if (!isObjectA && !isObjectB) {
|
227
250
|
return String(a) === String(b)
|
228
251
|
} else {
|
@@ -245,14 +268,35 @@ function once (fn) {
|
|
245
268
|
return function () {
|
246
269
|
if (!called) {
|
247
270
|
called = true;
|
248
|
-
fn();
|
271
|
+
fn.apply(this, arguments);
|
249
272
|
}
|
250
273
|
}
|
251
274
|
}
|
252
275
|
|
276
|
+
var SSR_ATTR = 'data-server-rendered';
|
277
|
+
|
278
|
+
var ASSET_TYPES = [
|
279
|
+
'component',
|
280
|
+
'directive',
|
281
|
+
'filter'
|
282
|
+
];
|
283
|
+
|
284
|
+
var LIFECYCLE_HOOKS = [
|
285
|
+
'beforeCreate',
|
286
|
+
'created',
|
287
|
+
'beforeMount',
|
288
|
+
'mounted',
|
289
|
+
'beforeUpdate',
|
290
|
+
'updated',
|
291
|
+
'beforeDestroy',
|
292
|
+
'destroyed',
|
293
|
+
'activated',
|
294
|
+
'deactivated'
|
295
|
+
];
|
296
|
+
|
253
297
|
/* */
|
254
298
|
|
255
|
-
var config = {
|
299
|
+
var config = ({
|
256
300
|
/**
|
257
301
|
* Option merge strategies (used in core/util/options)
|
258
302
|
*/
|
@@ -276,7 +320,7 @@ var config = {
|
|
276
320
|
/**
|
277
321
|
* Whether to record perf
|
278
322
|
*/
|
279
|
-
performance:
|
323
|
+
performance: false,
|
280
324
|
|
281
325
|
/**
|
282
326
|
* Error handler for watcher errors
|
@@ -299,6 +343,12 @@ var config = {
|
|
299
343
|
*/
|
300
344
|
isReservedTag: no,
|
301
345
|
|
346
|
+
/**
|
347
|
+
* Check if an attribute is reserved so that it cannot be used as a component
|
348
|
+
* prop. This is platform-dependent and may be overwritten.
|
349
|
+
*/
|
350
|
+
isReservedAttr: no,
|
351
|
+
|
302
352
|
/**
|
303
353
|
* Check if a tag is an unknown element.
|
304
354
|
* Platform-dependent.
|
@@ -322,35 +372,163 @@ var config = {
|
|
322
372
|
mustUseProp: no,
|
323
373
|
|
324
374
|
/**
|
325
|
-
*
|
375
|
+
* Exposed for legacy reasons
|
326
376
|
*/
|
327
|
-
|
328
|
-
|
329
|
-
'directive',
|
330
|
-
'filter'
|
331
|
-
],
|
377
|
+
_lifecycleHooks: LIFECYCLE_HOOKS
|
378
|
+
});
|
332
379
|
|
333
|
-
|
334
|
-
* List of lifecycle hooks.
|
335
|
-
*/
|
336
|
-
_lifecycleHooks: [
|
337
|
-
'beforeCreate',
|
338
|
-
'created',
|
339
|
-
'beforeMount',
|
340
|
-
'mounted',
|
341
|
-
'beforeUpdate',
|
342
|
-
'updated',
|
343
|
-
'beforeDestroy',
|
344
|
-
'destroyed',
|
345
|
-
'activated',
|
346
|
-
'deactivated'
|
347
|
-
],
|
380
|
+
/* */
|
348
381
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
382
|
+
var emptyObject = Object.freeze({});
|
383
|
+
|
384
|
+
/**
|
385
|
+
* Check if a string starts with $ or _
|
386
|
+
*/
|
387
|
+
function isReserved (str) {
|
388
|
+
var c = (str + '').charCodeAt(0);
|
389
|
+
return c === 0x24 || c === 0x5F
|
390
|
+
}
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Define a property.
|
394
|
+
*/
|
395
|
+
function def (obj, key, val, enumerable) {
|
396
|
+
Object.defineProperty(obj, key, {
|
397
|
+
value: val,
|
398
|
+
enumerable: !!enumerable,
|
399
|
+
writable: true,
|
400
|
+
configurable: true
|
401
|
+
});
|
402
|
+
}
|
403
|
+
|
404
|
+
/**
|
405
|
+
* Parse simple path.
|
406
|
+
*/
|
407
|
+
var bailRE = /[^\w.$]/;
|
408
|
+
function parsePath (path) {
|
409
|
+
if (bailRE.test(path)) {
|
410
|
+
return
|
411
|
+
}
|
412
|
+
var segments = path.split('.');
|
413
|
+
return function (obj) {
|
414
|
+
for (var i = 0; i < segments.length; i++) {
|
415
|
+
if (!obj) { return }
|
416
|
+
obj = obj[segments[i]];
|
417
|
+
}
|
418
|
+
return obj
|
419
|
+
}
|
420
|
+
}
|
421
|
+
|
422
|
+
/* */
|
423
|
+
|
424
|
+
var warn = noop;
|
425
|
+
var tip = noop;
|
426
|
+
var formatComponentName = (null); // work around flow check
|
427
|
+
|
428
|
+
{
|
429
|
+
var hasConsole = typeof console !== 'undefined';
|
430
|
+
var classifyRE = /(?:^|[-_])(\w)/g;
|
431
|
+
var classify = function (str) { return str
|
432
|
+
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
433
|
+
.replace(/[-_]/g, ''); };
|
434
|
+
|
435
|
+
warn = function (msg, vm) {
|
436
|
+
if (hasConsole && (!config.silent)) {
|
437
|
+
console.error("[Vue warn]: " + msg + (
|
438
|
+
vm ? generateComponentTrace(vm) : ''
|
439
|
+
));
|
440
|
+
}
|
441
|
+
};
|
442
|
+
|
443
|
+
tip = function (msg, vm) {
|
444
|
+
if (hasConsole && (!config.silent)) {
|
445
|
+
console.warn("[Vue tip]: " + msg + (
|
446
|
+
vm ? generateComponentTrace(vm) : ''
|
447
|
+
));
|
448
|
+
}
|
449
|
+
};
|
450
|
+
|
451
|
+
formatComponentName = function (vm, includeFile) {
|
452
|
+
if (vm.$root === vm) {
|
453
|
+
return '<Root>'
|
454
|
+
}
|
455
|
+
var name = typeof vm === 'string'
|
456
|
+
? vm
|
457
|
+
: typeof vm === 'function' && vm.options
|
458
|
+
? vm.options.name
|
459
|
+
: vm._isVue
|
460
|
+
? vm.$options.name || vm.$options._componentTag
|
461
|
+
: vm.name;
|
462
|
+
|
463
|
+
var file = vm._isVue && vm.$options.__file;
|
464
|
+
if (!name && file) {
|
465
|
+
var match = file.match(/([^/\\]+)\.vue$/);
|
466
|
+
name = match && match[1];
|
467
|
+
}
|
468
|
+
|
469
|
+
return (
|
470
|
+
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
471
|
+
(file && includeFile !== false ? (" at " + file) : '')
|
472
|
+
)
|
473
|
+
};
|
474
|
+
|
475
|
+
var repeat = function (str, n) {
|
476
|
+
var res = '';
|
477
|
+
while (n) {
|
478
|
+
if (n % 2 === 1) { res += str; }
|
479
|
+
if (n > 1) { str += str; }
|
480
|
+
n >>= 1;
|
481
|
+
}
|
482
|
+
return res
|
483
|
+
};
|
484
|
+
|
485
|
+
var generateComponentTrace = function (vm) {
|
486
|
+
if (vm._isVue && vm.$parent) {
|
487
|
+
var tree = [];
|
488
|
+
var currentRecursiveSequence = 0;
|
489
|
+
while (vm) {
|
490
|
+
if (tree.length > 0) {
|
491
|
+
var last = tree[tree.length - 1];
|
492
|
+
if (last.constructor === vm.constructor) {
|
493
|
+
currentRecursiveSequence++;
|
494
|
+
vm = vm.$parent;
|
495
|
+
continue
|
496
|
+
} else if (currentRecursiveSequence > 0) {
|
497
|
+
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
498
|
+
currentRecursiveSequence = 0;
|
499
|
+
}
|
500
|
+
}
|
501
|
+
tree.push(vm);
|
502
|
+
vm = vm.$parent;
|
503
|
+
}
|
504
|
+
return '\n\nfound in\n\n' + tree
|
505
|
+
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
506
|
+
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
507
|
+
: formatComponentName(vm))); })
|
508
|
+
.join('\n')
|
509
|
+
} else {
|
510
|
+
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
511
|
+
}
|
512
|
+
};
|
513
|
+
}
|
514
|
+
|
515
|
+
/* */
|
516
|
+
|
517
|
+
function handleError (err, vm, info) {
|
518
|
+
if (config.errorHandler) {
|
519
|
+
config.errorHandler.call(null, err, vm, info);
|
520
|
+
} else {
|
521
|
+
{
|
522
|
+
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
523
|
+
}
|
524
|
+
/* istanbul ignore else */
|
525
|
+
if (inBrowser && typeof console !== 'undefined') {
|
526
|
+
console.error(err);
|
527
|
+
} else {
|
528
|
+
throw err
|
529
|
+
}
|
530
|
+
}
|
531
|
+
}
|
354
532
|
|
355
533
|
/* */
|
356
534
|
/* globals MutationObserver */
|
@@ -368,6 +546,20 @@ var isAndroid = UA && UA.indexOf('android') > 0;
|
|
368
546
|
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
|
369
547
|
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
370
548
|
|
549
|
+
var supportsPassive = false;
|
550
|
+
if (inBrowser) {
|
551
|
+
try {
|
552
|
+
var opts = {};
|
553
|
+
Object.defineProperty(opts, 'passive', ({
|
554
|
+
get: function get () {
|
555
|
+
/* istanbul ignore next */
|
556
|
+
supportsPassive = true;
|
557
|
+
}
|
558
|
+
} )); // https://github.com/facebook/flow/issues/285
|
559
|
+
window.addEventListener('test-passive', null, opts);
|
560
|
+
} catch (e) {}
|
561
|
+
}
|
562
|
+
|
371
563
|
// this needs to be lazy-evaled because vue may be required before
|
372
564
|
// vue-server-renderer can set VUE_ENV
|
373
565
|
var _isServer;
|
@@ -390,7 +582,7 @@ var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
390
582
|
|
391
583
|
/* istanbul ignore next */
|
392
584
|
function isNative (Ctor) {
|
393
|
-
return /native code/.test(Ctor.toString())
|
585
|
+
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
394
586
|
}
|
395
587
|
|
396
588
|
var hasSymbol =
|
@@ -461,15 +653,22 @@ var nextTick = (function () {
|
|
461
653
|
return function queueNextTick (cb, ctx) {
|
462
654
|
var _resolve;
|
463
655
|
callbacks.push(function () {
|
464
|
-
if (cb) {
|
465
|
-
|
656
|
+
if (cb) {
|
657
|
+
try {
|
658
|
+
cb.call(ctx);
|
659
|
+
} catch (e) {
|
660
|
+
handleError(e, ctx, 'nextTick');
|
661
|
+
}
|
662
|
+
} else if (_resolve) {
|
663
|
+
_resolve(ctx);
|
664
|
+
}
|
466
665
|
});
|
467
666
|
if (!pending) {
|
468
667
|
pending = true;
|
469
668
|
timerFunc();
|
470
669
|
}
|
471
670
|
if (!cb && typeof Promise !== 'undefined') {
|
472
|
-
return new Promise(function (resolve) {
|
671
|
+
return new Promise(function (resolve, reject) {
|
473
672
|
_resolve = resolve;
|
474
673
|
})
|
475
674
|
}
|
@@ -501,124 +700,17 @@ if (typeof Set !== 'undefined' && isNative(Set)) {
|
|
501
700
|
}());
|
502
701
|
}
|
503
702
|
|
504
|
-
var perf;
|
505
|
-
|
506
|
-
{
|
507
|
-
perf = inBrowser && window.performance;
|
508
|
-
if (perf && (!perf.mark || !perf.measure)) {
|
509
|
-
perf = undefined;
|
510
|
-
}
|
511
|
-
}
|
512
|
-
|
513
703
|
/* */
|
514
704
|
|
515
|
-
var emptyObject = Object.freeze({});
|
516
|
-
|
517
|
-
/**
|
518
|
-
* Check if a string starts with $ or _
|
519
|
-
*/
|
520
|
-
function isReserved (str) {
|
521
|
-
var c = (str + '').charCodeAt(0);
|
522
|
-
return c === 0x24 || c === 0x5F
|
523
|
-
}
|
524
|
-
|
525
|
-
/**
|
526
|
-
* Define a property.
|
527
|
-
*/
|
528
|
-
function def (obj, key, val, enumerable) {
|
529
|
-
Object.defineProperty(obj, key, {
|
530
|
-
value: val,
|
531
|
-
enumerable: !!enumerable,
|
532
|
-
writable: true,
|
533
|
-
configurable: true
|
534
|
-
});
|
535
|
-
}
|
536
705
|
|
537
|
-
|
538
|
-
* Parse simple path.
|
539
|
-
*/
|
540
|
-
var bailRE = /[^\w.$]/;
|
541
|
-
function parsePath (path) {
|
542
|
-
if (bailRE.test(path)) {
|
543
|
-
return
|
544
|
-
} else {
|
545
|
-
var segments = path.split('.');
|
546
|
-
return function (obj) {
|
547
|
-
for (var i = 0; i < segments.length; i++) {
|
548
|
-
if (!obj) { return }
|
549
|
-
obj = obj[segments[i]];
|
550
|
-
}
|
551
|
-
return obj
|
552
|
-
}
|
553
|
-
}
|
554
|
-
}
|
555
|
-
|
556
|
-
var warn = noop;
|
557
|
-
var tip = noop;
|
558
|
-
var formatComponentName;
|
559
|
-
|
560
|
-
{
|
561
|
-
var hasConsole = typeof console !== 'undefined';
|
562
|
-
var classifyRE = /(?:^|[-_])(\w)/g;
|
563
|
-
var classify = function (str) { return str
|
564
|
-
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
565
|
-
.replace(/[-_]/g, ''); };
|
566
|
-
|
567
|
-
warn = function (msg, vm) {
|
568
|
-
if (hasConsole && (!config.silent)) {
|
569
|
-
console.error("[Vue warn]: " + msg + " " + (
|
570
|
-
vm ? formatLocation(formatComponentName(vm)) : ''
|
571
|
-
));
|
572
|
-
}
|
573
|
-
};
|
574
|
-
|
575
|
-
tip = function (msg, vm) {
|
576
|
-
if (hasConsole && (!config.silent)) {
|
577
|
-
console.warn("[Vue tip]: " + msg + " " + (
|
578
|
-
vm ? formatLocation(formatComponentName(vm)) : ''
|
579
|
-
));
|
580
|
-
}
|
581
|
-
};
|
582
|
-
|
583
|
-
formatComponentName = function (vm, includeFile) {
|
584
|
-
if (vm.$root === vm) {
|
585
|
-
return '<Root>'
|
586
|
-
}
|
587
|
-
var name = vm._isVue
|
588
|
-
? vm.$options.name || vm.$options._componentTag
|
589
|
-
: vm.name;
|
590
|
-
|
591
|
-
var file = vm._isVue && vm.$options.__file;
|
592
|
-
if (!name && file) {
|
593
|
-
var match = file.match(/([^/\\]+)\.vue$/);
|
594
|
-
name = match && match[1];
|
595
|
-
}
|
596
|
-
|
597
|
-
return (
|
598
|
-
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
599
|
-
(file && includeFile !== false ? (" at " + file) : '')
|
600
|
-
)
|
601
|
-
};
|
602
|
-
|
603
|
-
var formatLocation = function (str) {
|
604
|
-
if (str === "<Anonymous>") {
|
605
|
-
str += " - use the \"name\" option for better debugging messages.";
|
606
|
-
}
|
607
|
-
return ("\n(found in " + str + ")")
|
608
|
-
};
|
609
|
-
}
|
610
|
-
|
611
|
-
/* */
|
612
|
-
|
613
|
-
|
614
|
-
var uid$1 = 0;
|
706
|
+
var uid = 0;
|
615
707
|
|
616
708
|
/**
|
617
709
|
* A dep is an observable that can have multiple
|
618
710
|
* directives subscribing to it.
|
619
711
|
*/
|
620
712
|
var Dep = function Dep () {
|
621
|
-
this.id = uid
|
713
|
+
this.id = uid++;
|
622
714
|
this.subs = [];
|
623
715
|
};
|
624
716
|
|
@@ -637,7 +729,7 @@ Dep.prototype.depend = function depend () {
|
|
637
729
|
};
|
638
730
|
|
639
731
|
Dep.prototype.notify = function notify () {
|
640
|
-
//
|
732
|
+
// stabilize the subscriber list first
|
641
733
|
var subs = this.subs.slice();
|
642
734
|
for (var i = 0, l = subs.length; i < l; i++) {
|
643
735
|
subs[i].update();
|
@@ -880,27 +972,27 @@ function defineReactive$$1 (
|
|
880
972
|
* triggers change notification if the property doesn't
|
881
973
|
* already exist.
|
882
974
|
*/
|
883
|
-
function set (
|
884
|
-
if (Array.isArray(
|
885
|
-
|
886
|
-
|
975
|
+
function set (target, key, val) {
|
976
|
+
if (Array.isArray(target) && typeof key === 'number') {
|
977
|
+
target.length = Math.max(target.length, key);
|
978
|
+
target.splice(key, 1, val);
|
887
979
|
return val
|
888
980
|
}
|
889
|
-
if (hasOwn(
|
890
|
-
|
891
|
-
return
|
981
|
+
if (hasOwn(target, key)) {
|
982
|
+
target[key] = val;
|
983
|
+
return val
|
892
984
|
}
|
893
|
-
var ob =
|
894
|
-
if (
|
985
|
+
var ob = (target ).__ob__;
|
986
|
+
if (target._isVue || (ob && ob.vmCount)) {
|
895
987
|
"development" !== 'production' && warn(
|
896
988
|
'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
897
989
|
'at runtime - declare it upfront in the data option.'
|
898
990
|
);
|
899
|
-
return
|
991
|
+
return val
|
900
992
|
}
|
901
993
|
if (!ob) {
|
902
|
-
|
903
|
-
return
|
994
|
+
target[key] = val;
|
995
|
+
return val
|
904
996
|
}
|
905
997
|
defineReactive$$1(ob.value, key, val);
|
906
998
|
ob.dep.notify();
|
@@ -910,23 +1002,23 @@ function set (obj, key, val) {
|
|
910
1002
|
/**
|
911
1003
|
* Delete a property and trigger change if necessary.
|
912
1004
|
*/
|
913
|
-
function del (
|
914
|
-
if (Array.isArray(
|
915
|
-
|
1005
|
+
function del (target, key) {
|
1006
|
+
if (Array.isArray(target) && typeof key === 'number') {
|
1007
|
+
target.splice(key, 1);
|
916
1008
|
return
|
917
1009
|
}
|
918
|
-
var ob =
|
919
|
-
if (
|
1010
|
+
var ob = (target ).__ob__;
|
1011
|
+
if (target._isVue || (ob && ob.vmCount)) {
|
920
1012
|
"development" !== 'production' && warn(
|
921
1013
|
'Avoid deleting properties on a Vue instance or its root $data ' +
|
922
1014
|
'- just set it to null.'
|
923
1015
|
);
|
924
1016
|
return
|
925
1017
|
}
|
926
|
-
if (!hasOwn(
|
1018
|
+
if (!hasOwn(target, key)) {
|
927
1019
|
return
|
928
1020
|
}
|
929
|
-
delete
|
1021
|
+
delete target[key];
|
930
1022
|
if (!ob) {
|
931
1023
|
return
|
932
1024
|
}
|
@@ -1061,7 +1153,7 @@ function mergeHook (
|
|
1061
1153
|
: parentVal
|
1062
1154
|
}
|
1063
1155
|
|
1064
|
-
|
1156
|
+
LIFECYCLE_HOOKS.forEach(function (hook) {
|
1065
1157
|
strats[hook] = mergeHook;
|
1066
1158
|
});
|
1067
1159
|
|
@@ -1079,7 +1171,7 @@ function mergeAssets (parentVal, childVal) {
|
|
1079
1171
|
: res
|
1080
1172
|
}
|
1081
1173
|
|
1082
|
-
|
1174
|
+
ASSET_TYPES.forEach(function (type) {
|
1083
1175
|
strats[type + 's'] = mergeAssets;
|
1084
1176
|
});
|
1085
1177
|
|
@@ -1205,21 +1297,20 @@ function mergeOptions (
|
|
1205
1297
|
{
|
1206
1298
|
checkComponents(child);
|
1207
1299
|
}
|
1300
|
+
|
1301
|
+
if (typeof child === 'function') {
|
1302
|
+
child = child.options;
|
1303
|
+
}
|
1304
|
+
|
1208
1305
|
normalizeProps(child);
|
1209
1306
|
normalizeDirectives(child);
|
1210
1307
|
var extendsFrom = child.extends;
|
1211
1308
|
if (extendsFrom) {
|
1212
|
-
parent =
|
1213
|
-
? mergeOptions(parent, extendsFrom.options, vm)
|
1214
|
-
: mergeOptions(parent, extendsFrom, vm);
|
1309
|
+
parent = mergeOptions(parent, extendsFrom, vm);
|
1215
1310
|
}
|
1216
1311
|
if (child.mixins) {
|
1217
1312
|
for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1218
|
-
|
1219
|
-
if (mixin.prototype instanceof Vue$3) {
|
1220
|
-
mixin = mixin.options;
|
1221
|
-
}
|
1222
|
-
parent = mergeOptions(parent, mixin, vm);
|
1313
|
+
parent = mergeOptions(parent, child.mixins[i], vm);
|
1223
1314
|
}
|
1224
1315
|
}
|
1225
1316
|
var options = {};
|
@@ -1392,20 +1483,13 @@ function assertProp (
|
|
1392
1483
|
}
|
1393
1484
|
}
|
1394
1485
|
|
1395
|
-
|
1396
|
-
|
1397
|
-
*/
|
1486
|
+
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
1487
|
+
|
1398
1488
|
function assertType (value, type) {
|
1399
1489
|
var valid;
|
1400
1490
|
var expectedType = getType(type);
|
1401
|
-
if (expectedType
|
1402
|
-
valid = typeof value === (
|
1403
|
-
} else if (expectedType === 'Number') {
|
1404
|
-
valid = typeof value === (expectedType = 'number');
|
1405
|
-
} else if (expectedType === 'Boolean') {
|
1406
|
-
valid = typeof value === (expectedType = 'boolean');
|
1407
|
-
} else if (expectedType === 'Function') {
|
1408
|
-
valid = typeof value === (expectedType = 'function');
|
1491
|
+
if (simpleCheckRE.test(expectedType)) {
|
1492
|
+
valid = typeof value === expectedType.toLowerCase();
|
1409
1493
|
} else if (expectedType === 'Object') {
|
1410
1494
|
valid = isPlainObject(value);
|
1411
1495
|
} else if (expectedType === 'Array') {
|
@@ -1426,7 +1510,7 @@ function assertType (value, type) {
|
|
1426
1510
|
*/
|
1427
1511
|
function getType (fn) {
|
1428
1512
|
var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
1429
|
-
return match
|
1513
|
+
return match ? match[1] : ''
|
1430
1514
|
}
|
1431
1515
|
|
1432
1516
|
function isType (type, fn) {
|
@@ -1442,19 +1526,28 @@ function isType (type, fn) {
|
|
1442
1526
|
return false
|
1443
1527
|
}
|
1444
1528
|
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1529
|
+
/* */
|
1530
|
+
|
1531
|
+
var mark;
|
1532
|
+
var measure;
|
1533
|
+
|
1534
|
+
{
|
1535
|
+
var perf = inBrowser && window.performance;
|
1536
|
+
/* istanbul ignore if */
|
1537
|
+
if (
|
1538
|
+
perf &&
|
1539
|
+
perf.mark &&
|
1540
|
+
perf.measure &&
|
1541
|
+
perf.clearMarks &&
|
1542
|
+
perf.clearMeasures
|
1543
|
+
) {
|
1544
|
+
mark = function (tag) { return perf.mark(tag); };
|
1545
|
+
measure = function (name, startTag, endTag) {
|
1546
|
+
perf.measure(name, startTag, endTag);
|
1547
|
+
perf.clearMarks(startTag);
|
1548
|
+
perf.clearMarks(endTag);
|
1549
|
+
perf.clearMeasures(name);
|
1550
|
+
};
|
1458
1551
|
}
|
1459
1552
|
}
|
1460
1553
|
|
@@ -1606,8 +1699,9 @@ function cloneVNode (vnode) {
|
|
1606
1699
|
}
|
1607
1700
|
|
1608
1701
|
function cloneVNodes (vnodes) {
|
1609
|
-
var
|
1610
|
-
|
1702
|
+
var len = vnodes.length;
|
1703
|
+
var res = new Array(len);
|
1704
|
+
for (var i = 0; i < len; i++) {
|
1611
1705
|
res[i] = cloneVNode(vnodes[i]);
|
1612
1706
|
}
|
1613
1707
|
return res
|
@@ -1616,6 +1710,8 @@ function cloneVNodes (vnodes) {
|
|
1616
1710
|
/* */
|
1617
1711
|
|
1618
1712
|
var normalizeEvent = cached(function (name) {
|
1713
|
+
var passive = name.charAt(0) === '&';
|
1714
|
+
name = passive ? name.slice(1) : name;
|
1619
1715
|
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
|
1620
1716
|
name = once$$1 ? name.slice(1) : name;
|
1621
1717
|
var capture = name.charAt(0) === '!';
|
@@ -1623,7 +1719,8 @@ var normalizeEvent = cached(function (name) {
|
|
1623
1719
|
return {
|
1624
1720
|
name: name,
|
1625
1721
|
once: once$$1,
|
1626
|
-
capture: capture
|
1722
|
+
capture: capture,
|
1723
|
+
passive: passive
|
1627
1724
|
}
|
1628
1725
|
});
|
1629
1726
|
|
@@ -1657,23 +1754,23 @@ function updateListeners (
|
|
1657
1754
|
cur = on[name];
|
1658
1755
|
old = oldOn[name];
|
1659
1756
|
event = normalizeEvent(name);
|
1660
|
-
if (
|
1757
|
+
if (isUndef(cur)) {
|
1661
1758
|
"development" !== 'production' && warn(
|
1662
1759
|
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
1663
1760
|
vm
|
1664
1761
|
);
|
1665
|
-
} else if (
|
1666
|
-
if (
|
1762
|
+
} else if (isUndef(old)) {
|
1763
|
+
if (isUndef(cur.fns)) {
|
1667
1764
|
cur = on[name] = createFnInvoker(cur);
|
1668
1765
|
}
|
1669
|
-
add(event.name, cur, event.once, event.capture);
|
1766
|
+
add(event.name, cur, event.once, event.capture, event.passive);
|
1670
1767
|
} else if (cur !== old) {
|
1671
1768
|
old.fns = cur;
|
1672
1769
|
on[name] = old;
|
1673
1770
|
}
|
1674
1771
|
}
|
1675
1772
|
for (name in oldOn) {
|
1676
|
-
if (
|
1773
|
+
if (isUndef(on[name])) {
|
1677
1774
|
event = normalizeEvent(name);
|
1678
1775
|
remove$$1(event.name, oldOn[name], event.capture);
|
1679
1776
|
}
|
@@ -1693,12 +1790,12 @@ function mergeVNodeHook (def, hookKey, hook) {
|
|
1693
1790
|
remove(invoker.fns, wrappedHook);
|
1694
1791
|
}
|
1695
1792
|
|
1696
|
-
if (
|
1793
|
+
if (isUndef(oldHook)) {
|
1697
1794
|
// no existing hook
|
1698
1795
|
invoker = createFnInvoker([wrappedHook]);
|
1699
1796
|
} else {
|
1700
1797
|
/* istanbul ignore if */
|
1701
|
-
if (oldHook.fns && oldHook.merged) {
|
1798
|
+
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
1702
1799
|
// already a merged invoker
|
1703
1800
|
invoker = oldHook;
|
1704
1801
|
invoker.fns.push(wrappedHook);
|
@@ -1714,6 +1811,74 @@ function mergeVNodeHook (def, hookKey, hook) {
|
|
1714
1811
|
|
1715
1812
|
/* */
|
1716
1813
|
|
1814
|
+
function extractPropsFromVNodeData (
|
1815
|
+
data,
|
1816
|
+
Ctor,
|
1817
|
+
tag
|
1818
|
+
) {
|
1819
|
+
// we are only extracting raw values here.
|
1820
|
+
// validation and default values are handled in the child
|
1821
|
+
// component itself.
|
1822
|
+
var propOptions = Ctor.options.props;
|
1823
|
+
if (isUndef(propOptions)) {
|
1824
|
+
return
|
1825
|
+
}
|
1826
|
+
var res = {};
|
1827
|
+
var attrs = data.attrs;
|
1828
|
+
var props = data.props;
|
1829
|
+
if (isDef(attrs) || isDef(props)) {
|
1830
|
+
for (var key in propOptions) {
|
1831
|
+
var altKey = hyphenate(key);
|
1832
|
+
{
|
1833
|
+
var keyInLowerCase = key.toLowerCase();
|
1834
|
+
if (
|
1835
|
+
key !== keyInLowerCase &&
|
1836
|
+
attrs && hasOwn(attrs, keyInLowerCase)
|
1837
|
+
) {
|
1838
|
+
tip(
|
1839
|
+
"Prop \"" + keyInLowerCase + "\" is passed to component " +
|
1840
|
+
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
1841
|
+
" \"" + key + "\". " +
|
1842
|
+
"Note that HTML attributes are case-insensitive and camelCased " +
|
1843
|
+
"props need to use their kebab-case equivalents when using in-DOM " +
|
1844
|
+
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
1845
|
+
);
|
1846
|
+
}
|
1847
|
+
}
|
1848
|
+
checkProp(res, props, key, altKey, true) ||
|
1849
|
+
checkProp(res, attrs, key, altKey, false);
|
1850
|
+
}
|
1851
|
+
}
|
1852
|
+
return res
|
1853
|
+
}
|
1854
|
+
|
1855
|
+
function checkProp (
|
1856
|
+
res,
|
1857
|
+
hash,
|
1858
|
+
key,
|
1859
|
+
altKey,
|
1860
|
+
preserve
|
1861
|
+
) {
|
1862
|
+
if (isDef(hash)) {
|
1863
|
+
if (hasOwn(hash, key)) {
|
1864
|
+
res[key] = hash[key];
|
1865
|
+
if (!preserve) {
|
1866
|
+
delete hash[key];
|
1867
|
+
}
|
1868
|
+
return true
|
1869
|
+
} else if (hasOwn(hash, altKey)) {
|
1870
|
+
res[key] = hash[altKey];
|
1871
|
+
if (!preserve) {
|
1872
|
+
delete hash[altKey];
|
1873
|
+
}
|
1874
|
+
return true
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
return false
|
1878
|
+
}
|
1879
|
+
|
1880
|
+
/* */
|
1881
|
+
|
1717
1882
|
// The template compiler attempts to minimize the need for normalization by
|
1718
1883
|
// statically analyzing the template at compile time.
|
1719
1884
|
//
|
@@ -1735,7 +1900,7 @@ function simpleNormalizeChildren (children) {
|
|
1735
1900
|
return children
|
1736
1901
|
}
|
1737
1902
|
|
1738
|
-
// 2. When the children contains
|
1903
|
+
// 2. When the children contains constructs that always generated nested Arrays,
|
1739
1904
|
// e.g. <template>, <slot>, v-for, or when the children is provided by user
|
1740
1905
|
// with hand-written render functions / JSX. In such cases a full normalization
|
1741
1906
|
// is needed to cater to all possible types of children values.
|
@@ -1752,24 +1917,24 @@ function normalizeArrayChildren (children, nestedIndex) {
|
|
1752
1917
|
var i, c, last;
|
1753
1918
|
for (i = 0; i < children.length; i++) {
|
1754
1919
|
c = children[i];
|
1755
|
-
if (c
|
1920
|
+
if (isUndef(c) || typeof c === 'boolean') { continue }
|
1756
1921
|
last = res[res.length - 1];
|
1757
1922
|
// nested
|
1758
1923
|
if (Array.isArray(c)) {
|
1759
1924
|
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
|
1760
1925
|
} else if (isPrimitive(c)) {
|
1761
|
-
if (last && last.text) {
|
1926
|
+
if (isDef(last) && isDef(last.text)) {
|
1762
1927
|
last.text += String(c);
|
1763
1928
|
} else if (c !== '') {
|
1764
1929
|
// convert primitive to vnode
|
1765
1930
|
res.push(createTextVNode(c));
|
1766
1931
|
}
|
1767
1932
|
} else {
|
1768
|
-
if (c.text && last && last.text) {
|
1933
|
+
if (isDef(c.text) && isDef(last) && isDef(last.text)) {
|
1769
1934
|
res[res.length - 1] = createTextVNode(last.text + c.text);
|
1770
1935
|
} else {
|
1771
1936
|
// default key for nested array children (likely generated by v-for)
|
1772
|
-
if (c.tag && c.key
|
1937
|
+
if (isDef(c.tag) && isUndef(c.key) && isDef(nestedIndex)) {
|
1773
1938
|
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
1774
1939
|
}
|
1775
1940
|
res.push(c);
|
@@ -1781,12 +1946,127 @@ function normalizeArrayChildren (children, nestedIndex) {
|
|
1781
1946
|
|
1782
1947
|
/* */
|
1783
1948
|
|
1949
|
+
function ensureCtor (comp, base) {
|
1950
|
+
return isObject(comp)
|
1951
|
+
? base.extend(comp)
|
1952
|
+
: comp
|
1953
|
+
}
|
1954
|
+
|
1955
|
+
function resolveAsyncComponent (
|
1956
|
+
factory,
|
1957
|
+
baseCtor,
|
1958
|
+
context
|
1959
|
+
) {
|
1960
|
+
if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
1961
|
+
return factory.errorComp
|
1962
|
+
}
|
1963
|
+
|
1964
|
+
if (isDef(factory.resolved)) {
|
1965
|
+
return factory.resolved
|
1966
|
+
}
|
1967
|
+
|
1968
|
+
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
1969
|
+
return factory.loadingComp
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
if (isDef(factory.contexts)) {
|
1973
|
+
// already pending
|
1974
|
+
factory.contexts.push(context);
|
1975
|
+
} else {
|
1976
|
+
var contexts = factory.contexts = [context];
|
1977
|
+
var sync = true;
|
1978
|
+
|
1979
|
+
var forceRender = function () {
|
1980
|
+
for (var i = 0, l = contexts.length; i < l; i++) {
|
1981
|
+
contexts[i].$forceUpdate();
|
1982
|
+
}
|
1983
|
+
};
|
1984
|
+
|
1985
|
+
var resolve = once(function (res) {
|
1986
|
+
// cache resolved
|
1987
|
+
factory.resolved = ensureCtor(res, baseCtor);
|
1988
|
+
// invoke callbacks only if this is not a synchronous resolve
|
1989
|
+
// (async resolves are shimmed as synchronous during SSR)
|
1990
|
+
if (!sync) {
|
1991
|
+
forceRender();
|
1992
|
+
}
|
1993
|
+
});
|
1994
|
+
|
1995
|
+
var reject = once(function (reason) {
|
1996
|
+
"development" !== 'production' && warn(
|
1997
|
+
"Failed to resolve async component: " + (String(factory)) +
|
1998
|
+
(reason ? ("\nReason: " + reason) : '')
|
1999
|
+
);
|
2000
|
+
if (isDef(factory.errorComp)) {
|
2001
|
+
factory.error = true;
|
2002
|
+
forceRender();
|
2003
|
+
}
|
2004
|
+
});
|
2005
|
+
|
2006
|
+
var res = factory(resolve, reject);
|
2007
|
+
|
2008
|
+
if (isObject(res)) {
|
2009
|
+
if (typeof res.then === 'function') {
|
2010
|
+
// () => Promise
|
2011
|
+
if (isUndef(factory.resolved)) {
|
2012
|
+
res.then(resolve, reject);
|
2013
|
+
}
|
2014
|
+
} else if (isDef(res.component) && typeof res.component.then === 'function') {
|
2015
|
+
res.component.then(resolve, reject);
|
2016
|
+
|
2017
|
+
if (isDef(res.error)) {
|
2018
|
+
factory.errorComp = ensureCtor(res.error, baseCtor);
|
2019
|
+
}
|
2020
|
+
|
2021
|
+
if (isDef(res.loading)) {
|
2022
|
+
factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
2023
|
+
if (res.delay === 0) {
|
2024
|
+
factory.loading = true;
|
2025
|
+
} else {
|
2026
|
+
setTimeout(function () {
|
2027
|
+
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
2028
|
+
factory.loading = true;
|
2029
|
+
forceRender();
|
2030
|
+
}
|
2031
|
+
}, res.delay || 200);
|
2032
|
+
}
|
2033
|
+
}
|
2034
|
+
|
2035
|
+
if (isDef(res.timeout)) {
|
2036
|
+
setTimeout(function () {
|
2037
|
+
reject(
|
2038
|
+
"timeout (" + (res.timeout) + "ms)"
|
2039
|
+
);
|
2040
|
+
}, res.timeout);
|
2041
|
+
}
|
2042
|
+
}
|
2043
|
+
}
|
2044
|
+
|
2045
|
+
sync = false;
|
2046
|
+
// return in case resolved synchronously
|
2047
|
+
return factory.loading
|
2048
|
+
? factory.loadingComp
|
2049
|
+
: factory.resolved
|
2050
|
+
}
|
2051
|
+
}
|
2052
|
+
|
2053
|
+
/* */
|
2054
|
+
|
1784
2055
|
function getFirstComponentChild (children) {
|
1785
|
-
|
2056
|
+
if (Array.isArray(children)) {
|
2057
|
+
for (var i = 0; i < children.length; i++) {
|
2058
|
+
var c = children[i];
|
2059
|
+
if (isDef(c) && isDef(c.componentOptions)) {
|
2060
|
+
return c
|
2061
|
+
}
|
2062
|
+
}
|
2063
|
+
}
|
1786
2064
|
}
|
1787
2065
|
|
1788
2066
|
/* */
|
1789
2067
|
|
2068
|
+
/* */
|
2069
|
+
|
1790
2070
|
function initEvents (vm) {
|
1791
2071
|
vm._events = Object.create(null);
|
1792
2072
|
vm._hasHookEvent = false;
|
@@ -1853,12 +2133,21 @@ function eventsMixin (Vue) {
|
|
1853
2133
|
};
|
1854
2134
|
|
1855
2135
|
Vue.prototype.$off = function (event, fn) {
|
2136
|
+
var this$1 = this;
|
2137
|
+
|
1856
2138
|
var vm = this;
|
1857
2139
|
// all
|
1858
2140
|
if (!arguments.length) {
|
1859
2141
|
vm._events = Object.create(null);
|
1860
2142
|
return vm
|
1861
2143
|
}
|
2144
|
+
// array of events
|
2145
|
+
if (Array.isArray(event)) {
|
2146
|
+
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
2147
|
+
this$1.$off(event[i$1], fn);
|
2148
|
+
}
|
2149
|
+
return vm
|
2150
|
+
}
|
1862
2151
|
// specific event
|
1863
2152
|
var cbs = vm._events[event];
|
1864
2153
|
if (!cbs) {
|
@@ -1883,6 +2172,18 @@ function eventsMixin (Vue) {
|
|
1883
2172
|
|
1884
2173
|
Vue.prototype.$emit = function (event) {
|
1885
2174
|
var vm = this;
|
2175
|
+
{
|
2176
|
+
var lowerCaseEvent = event.toLowerCase();
|
2177
|
+
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
2178
|
+
tip(
|
2179
|
+
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
2180
|
+
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
2181
|
+
"Note that HTML attributes are case-insensitive and you cannot use " +
|
2182
|
+
"v-on to listen to camelCase events when using in-DOM templates. " +
|
2183
|
+
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
2184
|
+
);
|
2185
|
+
}
|
2186
|
+
}
|
1886
2187
|
var cbs = vm._events[event];
|
1887
2188
|
if (cbs) {
|
1888
2189
|
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
@@ -1909,13 +2210,13 @@ function resolveSlots (
|
|
1909
2210
|
return slots
|
1910
2211
|
}
|
1911
2212
|
var defaultSlot = [];
|
1912
|
-
var name, child;
|
1913
2213
|
for (var i = 0, l = children.length; i < l; i++) {
|
1914
|
-
child = children[i];
|
2214
|
+
var child = children[i];
|
1915
2215
|
// named slots should only be respected if the vnode was rendered in the
|
1916
2216
|
// same context.
|
1917
2217
|
if ((child.context === context || child.functionalContext === context) &&
|
1918
|
-
child.data &&
|
2218
|
+
child.data && child.data.slot != null) {
|
2219
|
+
var name = child.data.slot;
|
1919
2220
|
var slot = (slots[name] || (slots[name] = []));
|
1920
2221
|
if (child.tag === 'template') {
|
1921
2222
|
slot.push.apply(slot, child.children);
|
@@ -1926,16 +2227,17 @@ function resolveSlots (
|
|
1926
2227
|
defaultSlot.push(child);
|
1927
2228
|
}
|
1928
2229
|
}
|
1929
|
-
// ignore
|
1930
|
-
if (defaultSlot.
|
1931
|
-
defaultSlot.length === 1 &&
|
1932
|
-
(defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
|
1933
|
-
)) {
|
2230
|
+
// ignore whitespace
|
2231
|
+
if (!defaultSlot.every(isWhitespace)) {
|
1934
2232
|
slots.default = defaultSlot;
|
1935
2233
|
}
|
1936
2234
|
return slots
|
1937
2235
|
}
|
1938
2236
|
|
2237
|
+
function isWhitespace (node) {
|
2238
|
+
return node.isComment || node.text === ' '
|
2239
|
+
}
|
2240
|
+
|
1939
2241
|
function resolveScopedSlots (
|
1940
2242
|
fns
|
1941
2243
|
) {
|
@@ -2050,6 +2352,9 @@ function lifecycleMixin (Vue) {
|
|
2050
2352
|
}
|
2051
2353
|
// call the last hook...
|
2052
2354
|
vm._isDestroyed = true;
|
2355
|
+
// invoke destroy hooks on current rendered tree
|
2356
|
+
vm.__patch__(vm._vnode, null);
|
2357
|
+
// fire destroyed hook
|
2053
2358
|
callHook(vm, 'destroyed');
|
2054
2359
|
// turn off all instance listeners.
|
2055
2360
|
vm.$off();
|
@@ -2057,8 +2362,8 @@ function lifecycleMixin (Vue) {
|
|
2057
2362
|
if (vm.$el) {
|
2058
2363
|
vm.$el.__vue__ = null;
|
2059
2364
|
}
|
2060
|
-
//
|
2061
|
-
vm.
|
2365
|
+
// remove reference to DOM nodes (prevents leak)
|
2366
|
+
vm.$options._parentElm = vm.$options._refElm = null;
|
2062
2367
|
};
|
2063
2368
|
}
|
2064
2369
|
|
@@ -2072,10 +2377,11 @@ function mountComponent (
|
|
2072
2377
|
vm.$options.render = createEmptyVNode;
|
2073
2378
|
{
|
2074
2379
|
/* istanbul ignore if */
|
2075
|
-
if (vm.$options.template && vm.$options.template.charAt(0) !== '#')
|
2380
|
+
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
2381
|
+
vm.$options.el || el) {
|
2076
2382
|
warn(
|
2077
2383
|
'You are using the runtime-only build of Vue where the template ' +
|
2078
|
-
'
|
2384
|
+
'compiler is not available. Either pre-compile the templates into ' +
|
2079
2385
|
'render functions, or use the compiler-included build.',
|
2080
2386
|
vm
|
2081
2387
|
);
|
@@ -2091,19 +2397,22 @@ function mountComponent (
|
|
2091
2397
|
|
2092
2398
|
var updateComponent;
|
2093
2399
|
/* istanbul ignore if */
|
2094
|
-
if ("development" !== 'production' && config.performance &&
|
2400
|
+
if ("development" !== 'production' && config.performance && mark) {
|
2095
2401
|
updateComponent = function () {
|
2096
2402
|
var name = vm._name;
|
2097
|
-
var
|
2098
|
-
var
|
2099
|
-
perf
|
2403
|
+
var id = vm._uid;
|
2404
|
+
var startTag = "vue-perf-start:" + id;
|
2405
|
+
var endTag = "vue-perf-end:" + id;
|
2406
|
+
|
2407
|
+
mark(startTag);
|
2100
2408
|
var vnode = vm._render();
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2409
|
+
mark(endTag);
|
2410
|
+
measure((name + " render"), startTag, endTag);
|
2411
|
+
|
2412
|
+
mark(startTag);
|
2104
2413
|
vm._update(vnode, hydrating);
|
2105
|
-
|
2106
|
-
|
2414
|
+
mark(endTag);
|
2415
|
+
measure((name + " patch"), startTag, endTag);
|
2107
2416
|
};
|
2108
2417
|
} else {
|
2109
2418
|
updateComponent = function () {
|
@@ -2194,7 +2503,7 @@ function activateChildComponent (vm, direct) {
|
|
2194
2503
|
} else if (vm._directInactive) {
|
2195
2504
|
return
|
2196
2505
|
}
|
2197
|
-
if (vm._inactive || vm._inactive
|
2506
|
+
if (vm._inactive || vm._inactive === null) {
|
2198
2507
|
vm._inactive = false;
|
2199
2508
|
for (var i = 0; i < vm.$children.length; i++) {
|
2200
2509
|
activateChildComponent(vm.$children[i]);
|
@@ -2238,7 +2547,10 @@ function callHook (vm, hook) {
|
|
2238
2547
|
/* */
|
2239
2548
|
|
2240
2549
|
|
2550
|
+
var MAX_UPDATE_COUNT = 100;
|
2551
|
+
|
2241
2552
|
var queue = [];
|
2553
|
+
var activatedChildren = [];
|
2242
2554
|
var has = {};
|
2243
2555
|
var circular = {};
|
2244
2556
|
var waiting = false;
|
@@ -2249,7 +2561,7 @@ var index = 0;
|
|
2249
2561
|
* Reset the scheduler's state.
|
2250
2562
|
*/
|
2251
2563
|
function resetSchedulerState () {
|
2252
|
-
queue.length = 0;
|
2564
|
+
queue.length = activatedChildren.length = 0;
|
2253
2565
|
has = {};
|
2254
2566
|
{
|
2255
2567
|
circular = {};
|
@@ -2262,7 +2574,7 @@ function resetSchedulerState () {
|
|
2262
2574
|
*/
|
2263
2575
|
function flushSchedulerQueue () {
|
2264
2576
|
flushing = true;
|
2265
|
-
var watcher, id
|
2577
|
+
var watcher, id;
|
2266
2578
|
|
2267
2579
|
// Sort queue before flush.
|
2268
2580
|
// This ensures that:
|
@@ -2284,7 +2596,7 @@ function flushSchedulerQueue () {
|
|
2284
2596
|
// in dev build, check and stop circular updates.
|
2285
2597
|
if ("development" !== 'production' && has[id] != null) {
|
2286
2598
|
circular[id] = (circular[id] || 0) + 1;
|
2287
|
-
if (circular[id] >
|
2599
|
+
if (circular[id] > MAX_UPDATE_COUNT) {
|
2288
2600
|
warn(
|
2289
2601
|
'You may have an infinite update loop ' + (
|
2290
2602
|
watcher.user
|
@@ -2298,23 +2610,50 @@ function flushSchedulerQueue () {
|
|
2298
2610
|
}
|
2299
2611
|
}
|
2300
2612
|
|
2301
|
-
//
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2613
|
+
// keep copies of post queues before resetting state
|
2614
|
+
var activatedQueue = activatedChildren.slice();
|
2615
|
+
var updatedQueue = queue.slice();
|
2616
|
+
|
2617
|
+
resetSchedulerState();
|
2618
|
+
|
2619
|
+
// call component updated and activated hooks
|
2620
|
+
callActivatedHooks(activatedQueue);
|
2621
|
+
callUpdateHooks(updatedQueue);
|
2310
2622
|
|
2311
2623
|
// devtool hook
|
2312
2624
|
/* istanbul ignore if */
|
2313
2625
|
if (devtools && config.devtools) {
|
2314
2626
|
devtools.emit('flush');
|
2315
2627
|
}
|
2628
|
+
}
|
2316
2629
|
|
2317
|
-
|
2630
|
+
function callUpdateHooks (queue) {
|
2631
|
+
var i = queue.length;
|
2632
|
+
while (i--) {
|
2633
|
+
var watcher = queue[i];
|
2634
|
+
var vm = watcher.vm;
|
2635
|
+
if (vm._watcher === watcher && vm._isMounted) {
|
2636
|
+
callHook(vm, 'updated');
|
2637
|
+
}
|
2638
|
+
}
|
2639
|
+
}
|
2640
|
+
|
2641
|
+
/**
|
2642
|
+
* Queue a kept-alive component that was activated during patch.
|
2643
|
+
* The queue will be processed after the entire tree has been patched.
|
2644
|
+
*/
|
2645
|
+
function queueActivatedComponent (vm) {
|
2646
|
+
// setting _inactive to false here so that a render function can
|
2647
|
+
// rely on checking whether it's in an inactive tree (e.g. router-view)
|
2648
|
+
vm._inactive = false;
|
2649
|
+
activatedChildren.push(vm);
|
2650
|
+
}
|
2651
|
+
|
2652
|
+
function callActivatedHooks (queue) {
|
2653
|
+
for (var i = 0; i < queue.length; i++) {
|
2654
|
+
queue[i]._inactive = true;
|
2655
|
+
activateChildComponent(queue[i], true /* true */);
|
2656
|
+
}
|
2318
2657
|
}
|
2319
2658
|
|
2320
2659
|
/**
|
@@ -2618,7 +2957,11 @@ function initState (vm) {
|
|
2618
2957
|
if (opts.watch) { initWatch(vm, opts.watch); }
|
2619
2958
|
}
|
2620
2959
|
|
2621
|
-
var isReservedProp = {
|
2960
|
+
var isReservedProp = {
|
2961
|
+
key: 1,
|
2962
|
+
ref: 1,
|
2963
|
+
slot: 1
|
2964
|
+
};
|
2622
2965
|
|
2623
2966
|
function initProps (vm, propsOptions) {
|
2624
2967
|
var propsData = vm.$options.propsData || {};
|
@@ -2634,7 +2977,7 @@ function initProps (vm, propsOptions) {
|
|
2634
2977
|
var value = validateProp(key, propsOptions, propsData, vm);
|
2635
2978
|
/* istanbul ignore else */
|
2636
2979
|
{
|
2637
|
-
if (isReservedProp[key]) {
|
2980
|
+
if (isReservedProp[key] || config.isReservedAttr(key)) {
|
2638
2981
|
warn(
|
2639
2982
|
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
|
2640
2983
|
vm
|
@@ -2667,7 +3010,7 @@ function initProps (vm, propsOptions) {
|
|
2667
3010
|
function initData (vm) {
|
2668
3011
|
var data = vm.$options.data;
|
2669
3012
|
data = vm._data = typeof data === 'function'
|
2670
|
-
? data
|
3013
|
+
? getData(data, vm)
|
2671
3014
|
: data || {};
|
2672
3015
|
if (!isPlainObject(data)) {
|
2673
3016
|
data = {};
|
@@ -2696,6 +3039,15 @@ function initData (vm) {
|
|
2696
3039
|
observe(data, true /* asRootData */);
|
2697
3040
|
}
|
2698
3041
|
|
3042
|
+
function getData (data, vm) {
|
3043
|
+
try {
|
3044
|
+
return data.call(vm)
|
3045
|
+
} catch (e) {
|
3046
|
+
handleError(e, vm, "data()");
|
3047
|
+
return {}
|
3048
|
+
}
|
3049
|
+
}
|
3050
|
+
|
2699
3051
|
var computedWatcherOptions = { lazy: true };
|
2700
3052
|
|
2701
3053
|
function initComputed (vm, computed) {
|
@@ -2704,6 +3056,15 @@ function initComputed (vm, computed) {
|
|
2704
3056
|
for (var key in computed) {
|
2705
3057
|
var userDef = computed[key];
|
2706
3058
|
var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
3059
|
+
{
|
3060
|
+
if (getter === undefined) {
|
3061
|
+
warn(
|
3062
|
+
("No getter function has been defined for computed property \"" + key + "\"."),
|
3063
|
+
vm
|
3064
|
+
);
|
3065
|
+
getter = noop;
|
3066
|
+
}
|
3067
|
+
}
|
2707
3068
|
// create internal watcher for the computed property.
|
2708
3069
|
watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
|
2709
3070
|
|
@@ -2712,6 +3073,12 @@ function initComputed (vm, computed) {
|
|
2712
3073
|
// at instantiation here.
|
2713
3074
|
if (!(key in vm)) {
|
2714
3075
|
defineComputed(vm, key, userDef);
|
3076
|
+
} else {
|
3077
|
+
if (key in vm.$data) {
|
3078
|
+
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
3079
|
+
} else if (vm.$options.props && key in vm.$options.props) {
|
3080
|
+
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
3081
|
+
}
|
2715
3082
|
}
|
2716
3083
|
}
|
2717
3084
|
}
|
@@ -2841,94 +3208,64 @@ function stateMixin (Vue) {
|
|
2841
3208
|
|
2842
3209
|
/* */
|
2843
3210
|
|
2844
|
-
|
2845
|
-
var
|
2846
|
-
|
2847
|
-
|
2848
|
-
|
2849
|
-
|
2850
|
-
context,
|
2851
|
-
children,
|
2852
|
-
tag
|
2853
|
-
) {
|
2854
|
-
if (!Ctor) {
|
2855
|
-
return
|
3211
|
+
function initProvide (vm) {
|
3212
|
+
var provide = vm.$options.provide;
|
3213
|
+
if (provide) {
|
3214
|
+
vm._provided = typeof provide === 'function'
|
3215
|
+
? provide.call(vm)
|
3216
|
+
: provide;
|
2856
3217
|
}
|
3218
|
+
}
|
2857
3219
|
|
2858
|
-
|
2859
|
-
|
2860
|
-
|
3220
|
+
function initInjections (vm) {
|
3221
|
+
var result = resolveInject(vm.$options.inject, vm);
|
3222
|
+
if (result) {
|
3223
|
+
Object.keys(result).forEach(function (key) {
|
3224
|
+
/* istanbul ignore else */
|
3225
|
+
{
|
3226
|
+
defineReactive$$1(vm, key, result[key], function () {
|
3227
|
+
warn(
|
3228
|
+
"Avoid mutating an injected value directly since the changes will be " +
|
3229
|
+
"overwritten whenever the provided component re-renders. " +
|
3230
|
+
"injection being mutated: \"" + key + "\"",
|
3231
|
+
vm
|
3232
|
+
);
|
3233
|
+
});
|
3234
|
+
}
|
3235
|
+
});
|
2861
3236
|
}
|
3237
|
+
}
|
2862
3238
|
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
3239
|
+
function resolveInject (inject, vm) {
|
3240
|
+
if (inject) {
|
3241
|
+
// inject is :any because flow is not smart enough to figure out cached
|
3242
|
+
// isArray here
|
3243
|
+
var isArray = Array.isArray(inject);
|
3244
|
+
var result = Object.create(null);
|
3245
|
+
var keys = isArray
|
3246
|
+
? inject
|
3247
|
+
: hasSymbol
|
3248
|
+
? Reflect.ownKeys(inject)
|
3249
|
+
: Object.keys(inject);
|
2869
3250
|
|
2870
|
-
|
2871
|
-
|
2872
|
-
|
2873
|
-
|
2874
|
-
|
2875
|
-
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
if (!Ctor) {
|
2881
|
-
// return nothing if this is indeed an async component
|
2882
|
-
// wait for the callback to trigger parent update.
|
2883
|
-
return
|
3251
|
+
for (var i = 0; i < keys.length; i++) {
|
3252
|
+
var key = keys[i];
|
3253
|
+
var provideKey = isArray ? key : inject[key];
|
3254
|
+
var source = vm;
|
3255
|
+
while (source) {
|
3256
|
+
if (source._provided && provideKey in source._provided) {
|
3257
|
+
result[key] = source._provided[provideKey];
|
3258
|
+
break
|
3259
|
+
}
|
3260
|
+
source = source.$parent;
|
2884
3261
|
}
|
2885
3262
|
}
|
3263
|
+
return result
|
2886
3264
|
}
|
2887
|
-
|
2888
|
-
// resolve constructor options in case global mixins are applied after
|
2889
|
-
// component constructor creation
|
2890
|
-
resolveConstructorOptions(Ctor);
|
2891
|
-
|
2892
|
-
data = data || {};
|
2893
|
-
|
2894
|
-
// transform component v-model data into props & events
|
2895
|
-
if (data.model) {
|
2896
|
-
transformModel(Ctor.options, data);
|
2897
|
-
}
|
2898
|
-
|
2899
|
-
// extract props
|
2900
|
-
var propsData = extractProps(data, Ctor);
|
2901
|
-
|
2902
|
-
// functional component
|
2903
|
-
if (Ctor.options.functional) {
|
2904
|
-
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
2905
|
-
}
|
2906
|
-
|
2907
|
-
// extract listeners, since these needs to be treated as
|
2908
|
-
// child component listeners instead of DOM listeners
|
2909
|
-
var listeners = data.on;
|
2910
|
-
// replace with listeners with .native modifier
|
2911
|
-
data.on = data.nativeOn;
|
2912
|
-
|
2913
|
-
if (Ctor.options.abstract) {
|
2914
|
-
// abstract components do not keep anything
|
2915
|
-
// other than props & listeners
|
2916
|
-
data = {};
|
2917
|
-
}
|
2918
|
-
|
2919
|
-
// merge component management hooks onto the placeholder node
|
2920
|
-
mergeHooks(data);
|
2921
|
-
|
2922
|
-
// return a placeholder vnode
|
2923
|
-
var name = Ctor.options.name || tag;
|
2924
|
-
var vnode = new VNode(
|
2925
|
-
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
2926
|
-
data, undefined, undefined, undefined, context,
|
2927
|
-
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
|
2928
|
-
);
|
2929
|
-
return vnode
|
2930
3265
|
}
|
2931
3266
|
|
3267
|
+
/* */
|
3268
|
+
|
2932
3269
|
function createFunctionalComponent (
|
2933
3270
|
Ctor,
|
2934
3271
|
propsData,
|
@@ -2938,24 +3275,30 @@ function createFunctionalComponent (
|
|
2938
3275
|
) {
|
2939
3276
|
var props = {};
|
2940
3277
|
var propOptions = Ctor.options.props;
|
2941
|
-
if (propOptions) {
|
3278
|
+
if (isDef(propOptions)) {
|
2942
3279
|
for (var key in propOptions) {
|
2943
|
-
props[key] = validateProp(key, propOptions, propsData);
|
3280
|
+
props[key] = validateProp(key, propOptions, propsData || {});
|
2944
3281
|
}
|
3282
|
+
} else {
|
3283
|
+
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
3284
|
+
if (isDef(data.props)) { mergeProps(props, data.props); }
|
2945
3285
|
}
|
2946
3286
|
// ensure the createElement function in functional components
|
2947
3287
|
// gets a unique context - this is necessary for correct named slot check
|
2948
3288
|
var _context = Object.create(context);
|
2949
3289
|
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
|
2950
3290
|
var vnode = Ctor.options.render.call(null, h, {
|
2951
|
-
props: props,
|
2952
3291
|
data: data,
|
2953
|
-
|
3292
|
+
props: props,
|
2954
3293
|
children: children,
|
3294
|
+
parent: context,
|
3295
|
+
listeners: data.on || {},
|
3296
|
+
injections: resolveInject(Ctor.options.inject, context),
|
2955
3297
|
slots: function () { return resolveSlots(children, context); }
|
2956
3298
|
});
|
2957
3299
|
if (vnode instanceof VNode) {
|
2958
3300
|
vnode.functionalContext = context;
|
3301
|
+
vnode.functionalOptions = Ctor.options;
|
2959
3302
|
if (data.slot) {
|
2960
3303
|
(vnode.data || (vnode.data = {})).slot = data.slot;
|
2961
3304
|
}
|
@@ -2963,183 +3306,190 @@ function createFunctionalComponent (
|
|
2963
3306
|
return vnode
|
2964
3307
|
}
|
2965
3308
|
|
2966
|
-
function
|
2967
|
-
|
2968
|
-
|
2969
|
-
parentElm,
|
2970
|
-
refElm
|
2971
|
-
) {
|
2972
|
-
var vnodeComponentOptions = vnode.componentOptions;
|
2973
|
-
var options = {
|
2974
|
-
_isComponent: true,
|
2975
|
-
parent: parent,
|
2976
|
-
propsData: vnodeComponentOptions.propsData,
|
2977
|
-
_componentTag: vnodeComponentOptions.tag,
|
2978
|
-
_parentVnode: vnode,
|
2979
|
-
_parentListeners: vnodeComponentOptions.listeners,
|
2980
|
-
_renderChildren: vnodeComponentOptions.children,
|
2981
|
-
_parentElm: parentElm || null,
|
2982
|
-
_refElm: refElm || null
|
2983
|
-
};
|
2984
|
-
// check inline-template render functions
|
2985
|
-
var inlineTemplate = vnode.data.inlineTemplate;
|
2986
|
-
if (inlineTemplate) {
|
2987
|
-
options.render = inlineTemplate.render;
|
2988
|
-
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
3309
|
+
function mergeProps (to, from) {
|
3310
|
+
for (var key in from) {
|
3311
|
+
to[camelize(key)] = from[key];
|
2989
3312
|
}
|
2990
|
-
return new vnodeComponentOptions.Ctor(options)
|
2991
3313
|
}
|
2992
3314
|
|
2993
|
-
|
2994
|
-
|
2995
|
-
|
2996
|
-
|
2997
|
-
|
2998
|
-
|
2999
|
-
|
3000
|
-
|
3001
|
-
|
3002
|
-
|
3003
|
-
|
3004
|
-
|
3315
|
+
/* */
|
3316
|
+
|
3317
|
+
// hooks to be invoked on component VNodes during patch
|
3318
|
+
var componentVNodeHooks = {
|
3319
|
+
init: function init (
|
3320
|
+
vnode,
|
3321
|
+
hydrating,
|
3322
|
+
parentElm,
|
3323
|
+
refElm
|
3324
|
+
) {
|
3325
|
+
if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
|
3326
|
+
var child = vnode.componentInstance = createComponentInstanceForVnode(
|
3327
|
+
vnode,
|
3328
|
+
activeInstance,
|
3329
|
+
parentElm,
|
3330
|
+
refElm
|
3331
|
+
);
|
3332
|
+
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
3333
|
+
} else if (vnode.data.keepAlive) {
|
3334
|
+
// kept-alive components, treat as a patch
|
3335
|
+
var mountedNode = vnode; // work around flow
|
3336
|
+
componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
3337
|
+
}
|
3338
|
+
},
|
3339
|
+
|
3340
|
+
prepatch: function prepatch (oldVnode, vnode) {
|
3341
|
+
var options = vnode.componentOptions;
|
3342
|
+
var child = vnode.componentInstance = oldVnode.componentInstance;
|
3343
|
+
updateChildComponent(
|
3344
|
+
child,
|
3345
|
+
options.propsData, // updated props
|
3346
|
+
options.listeners, // updated listeners
|
3347
|
+
vnode, // new parent vnode
|
3348
|
+
options.children // new children
|
3005
3349
|
);
|
3006
|
-
|
3007
|
-
|
3008
|
-
|
3009
|
-
var
|
3010
|
-
|
3350
|
+
},
|
3351
|
+
|
3352
|
+
insert: function insert (vnode) {
|
3353
|
+
var context = vnode.context;
|
3354
|
+
var componentInstance = vnode.componentInstance;
|
3355
|
+
if (!componentInstance._isMounted) {
|
3356
|
+
componentInstance._isMounted = true;
|
3357
|
+
callHook(componentInstance, 'mounted');
|
3358
|
+
}
|
3359
|
+
if (vnode.data.keepAlive) {
|
3360
|
+
if (context._isMounted) {
|
3361
|
+
// vue-router#1212
|
3362
|
+
// During updates, a kept-alive component's child components may
|
3363
|
+
// change, so directly walking the tree here may call activated hooks
|
3364
|
+
// on incorrect children. Instead we push them into a queue which will
|
3365
|
+
// be processed after the whole patch process ended.
|
3366
|
+
queueActivatedComponent(componentInstance);
|
3367
|
+
} else {
|
3368
|
+
activateChildComponent(componentInstance, true /* direct */);
|
3369
|
+
}
|
3370
|
+
}
|
3371
|
+
},
|
3372
|
+
|
3373
|
+
destroy: function destroy (vnode) {
|
3374
|
+
var componentInstance = vnode.componentInstance;
|
3375
|
+
if (!componentInstance._isDestroyed) {
|
3376
|
+
if (!vnode.data.keepAlive) {
|
3377
|
+
componentInstance.$destroy();
|
3378
|
+
} else {
|
3379
|
+
deactivateChildComponent(componentInstance, true /* direct */);
|
3380
|
+
}
|
3381
|
+
}
|
3011
3382
|
}
|
3012
|
-
}
|
3383
|
+
};
|
3013
3384
|
|
3014
|
-
|
3015
|
-
oldVnode,
|
3016
|
-
vnode
|
3017
|
-
) {
|
3018
|
-
var options = vnode.componentOptions;
|
3019
|
-
var child = vnode.componentInstance = oldVnode.componentInstance;
|
3020
|
-
updateChildComponent(
|
3021
|
-
child,
|
3022
|
-
options.propsData, // updated props
|
3023
|
-
options.listeners, // updated listeners
|
3024
|
-
vnode, // new parent vnode
|
3025
|
-
options.children // new children
|
3026
|
-
);
|
3027
|
-
}
|
3385
|
+
var hooksToMerge = Object.keys(componentVNodeHooks);
|
3028
3386
|
|
3029
|
-
function
|
3030
|
-
|
3031
|
-
|
3032
|
-
|
3387
|
+
function createComponent (
|
3388
|
+
Ctor,
|
3389
|
+
data,
|
3390
|
+
context,
|
3391
|
+
children,
|
3392
|
+
tag
|
3393
|
+
) {
|
3394
|
+
if (isUndef(Ctor)) {
|
3395
|
+
return
|
3033
3396
|
}
|
3034
|
-
|
3035
|
-
|
3397
|
+
|
3398
|
+
var baseCtor = context.$options._base;
|
3399
|
+
|
3400
|
+
// plain options object: turn it into a constructor
|
3401
|
+
if (isObject(Ctor)) {
|
3402
|
+
Ctor = baseCtor.extend(Ctor);
|
3036
3403
|
}
|
3037
|
-
}
|
3038
3404
|
|
3039
|
-
|
3040
|
-
|
3041
|
-
|
3042
|
-
|
3043
|
-
|
3044
|
-
deactivateChildComponent(vnode.componentInstance, true /* direct */);
|
3405
|
+
// if at this stage it's not a constructor or an async component factory,
|
3406
|
+
// reject.
|
3407
|
+
if (typeof Ctor !== 'function') {
|
3408
|
+
{
|
3409
|
+
warn(("Invalid Component definition: " + (String(Ctor))), context);
|
3045
3410
|
}
|
3411
|
+
return
|
3046
3412
|
}
|
3047
|
-
}
|
3048
|
-
|
3049
|
-
function resolveAsyncComponent (
|
3050
|
-
factory,
|
3051
|
-
baseCtor,
|
3052
|
-
cb
|
3053
|
-
) {
|
3054
|
-
if (factory.requested) {
|
3055
|
-
// pool callbacks
|
3056
|
-
factory.pendingCallbacks.push(cb);
|
3057
|
-
} else {
|
3058
|
-
factory.requested = true;
|
3059
|
-
var cbs = factory.pendingCallbacks = [cb];
|
3060
|
-
var sync = true;
|
3061
|
-
|
3062
|
-
var resolve = function (res) {
|
3063
|
-
if (isObject(res)) {
|
3064
|
-
res = baseCtor.extend(res);
|
3065
|
-
}
|
3066
|
-
// cache resolved
|
3067
|
-
factory.resolved = res;
|
3068
|
-
// invoke callbacks only if this is not a synchronous resolve
|
3069
|
-
// (async resolves are shimmed as synchronous during SSR)
|
3070
|
-
if (!sync) {
|
3071
|
-
for (var i = 0, l = cbs.length; i < l; i++) {
|
3072
|
-
cbs[i](res);
|
3073
|
-
}
|
3074
|
-
}
|
3075
|
-
};
|
3076
3413
|
|
3077
|
-
|
3078
|
-
|
3079
|
-
|
3080
|
-
|
3081
|
-
|
3082
|
-
|
3414
|
+
// async component
|
3415
|
+
if (isUndef(Ctor.cid)) {
|
3416
|
+
Ctor = resolveAsyncComponent(Ctor, baseCtor, context);
|
3417
|
+
if (Ctor === undefined) {
|
3418
|
+
// return nothing if this is indeed an async component
|
3419
|
+
// wait for the callback to trigger parent update.
|
3420
|
+
return
|
3421
|
+
}
|
3422
|
+
}
|
3083
3423
|
|
3084
|
-
|
3424
|
+
// resolve constructor options in case global mixins are applied after
|
3425
|
+
// component constructor creation
|
3426
|
+
resolveConstructorOptions(Ctor);
|
3085
3427
|
|
3086
|
-
|
3087
|
-
if (res && typeof res.then === 'function' && !factory.resolved) {
|
3088
|
-
res.then(resolve, reject);
|
3089
|
-
}
|
3428
|
+
data = data || {};
|
3090
3429
|
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3430
|
+
// transform component v-model data into props & events
|
3431
|
+
if (isDef(data.model)) {
|
3432
|
+
transformModel(Ctor.options, data);
|
3094
3433
|
}
|
3095
|
-
}
|
3096
3434
|
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
// component
|
3101
|
-
|
3102
|
-
|
3103
|
-
return
|
3435
|
+
// extract props
|
3436
|
+
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
3437
|
+
|
3438
|
+
// functional component
|
3439
|
+
if (isTrue(Ctor.options.functional)) {
|
3440
|
+
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
3104
3441
|
}
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
var
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
}
|
3442
|
+
|
3443
|
+
// extract listeners, since these needs to be treated as
|
3444
|
+
// child component listeners instead of DOM listeners
|
3445
|
+
var listeners = data.on;
|
3446
|
+
// replace with listeners with .native modifier
|
3447
|
+
data.on = data.nativeOn;
|
3448
|
+
|
3449
|
+
if (isTrue(Ctor.options.abstract)) {
|
3450
|
+
// abstract components do not keep anything
|
3451
|
+
// other than props & listeners
|
3452
|
+
data = {};
|
3116
3453
|
}
|
3117
|
-
|
3454
|
+
|
3455
|
+
// merge component management hooks onto the placeholder node
|
3456
|
+
mergeHooks(data);
|
3457
|
+
|
3458
|
+
// return a placeholder vnode
|
3459
|
+
var name = Ctor.options.name || tag;
|
3460
|
+
var vnode = new VNode(
|
3461
|
+
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
3462
|
+
data, undefined, undefined, undefined, context,
|
3463
|
+
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
|
3464
|
+
);
|
3465
|
+
return vnode
|
3118
3466
|
}
|
3119
3467
|
|
3120
|
-
function
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
preserve
|
3468
|
+
function createComponentInstanceForVnode (
|
3469
|
+
vnode, // we know it's MountedComponentVNode but flow doesn't
|
3470
|
+
parent, // activeInstance in lifecycle state
|
3471
|
+
parentElm,
|
3472
|
+
refElm
|
3126
3473
|
) {
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3474
|
+
var vnodeComponentOptions = vnode.componentOptions;
|
3475
|
+
var options = {
|
3476
|
+
_isComponent: true,
|
3477
|
+
parent: parent,
|
3478
|
+
propsData: vnodeComponentOptions.propsData,
|
3479
|
+
_componentTag: vnodeComponentOptions.tag,
|
3480
|
+
_parentVnode: vnode,
|
3481
|
+
_parentListeners: vnodeComponentOptions.listeners,
|
3482
|
+
_renderChildren: vnodeComponentOptions.children,
|
3483
|
+
_parentElm: parentElm || null,
|
3484
|
+
_refElm: refElm || null
|
3485
|
+
};
|
3486
|
+
// check inline-template render functions
|
3487
|
+
var inlineTemplate = vnode.data.inlineTemplate;
|
3488
|
+
if (isDef(inlineTemplate)) {
|
3489
|
+
options.render = inlineTemplate.render;
|
3490
|
+
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
3141
3491
|
}
|
3142
|
-
return
|
3492
|
+
return new vnodeComponentOptions.Ctor(options)
|
3143
3493
|
}
|
3144
3494
|
|
3145
3495
|
function mergeHooks (data) {
|
@@ -3149,7 +3499,7 @@ function mergeHooks (data) {
|
|
3149
3499
|
for (var i = 0; i < hooksToMerge.length; i++) {
|
3150
3500
|
var key = hooksToMerge[i];
|
3151
3501
|
var fromParent = data.hook[key];
|
3152
|
-
var ours =
|
3502
|
+
var ours = componentVNodeHooks[key];
|
3153
3503
|
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
|
3154
3504
|
}
|
3155
3505
|
}
|
@@ -3167,7 +3517,7 @@ function transformModel (options, data) {
|
|
3167
3517
|
var prop = (options.model && options.model.prop) || 'value';
|
3168
3518
|
var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
|
3169
3519
|
var on = data.on || (data.on = {});
|
3170
|
-
if (on[event]) {
|
3520
|
+
if (isDef(on[event])) {
|
3171
3521
|
on[event] = [data.model.callback].concat(on[event]);
|
3172
3522
|
} else {
|
3173
3523
|
on[event] = data.model.callback;
|
@@ -3194,7 +3544,9 @@ function createElement (
|
|
3194
3544
|
children = data;
|
3195
3545
|
data = undefined;
|
3196
3546
|
}
|
3197
|
-
if (alwaysNormalize) {
|
3547
|
+
if (isTrue(alwaysNormalize)) {
|
3548
|
+
normalizationType = ALWAYS_NORMALIZE;
|
3549
|
+
}
|
3198
3550
|
return _createElement(context, tag, data, children, normalizationType)
|
3199
3551
|
}
|
3200
3552
|
|
@@ -3205,7 +3557,7 @@ function _createElement (
|
|
3205
3557
|
children,
|
3206
3558
|
normalizationType
|
3207
3559
|
) {
|
3208
|
-
if (data && data.__ob__) {
|
3560
|
+
if (isDef(data) && isDef((data).__ob__)) {
|
3209
3561
|
"development" !== 'production' && warn(
|
3210
3562
|
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
3211
3563
|
'Always create fresh vnode data objects in each render!',
|
@@ -3239,7 +3591,7 @@ function _createElement (
|
|
3239
3591
|
config.parsePlatformTagName(tag), data, children,
|
3240
3592
|
undefined, undefined, context
|
3241
3593
|
);
|
3242
|
-
} else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
|
3594
|
+
} else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
3243
3595
|
// component
|
3244
3596
|
vnode = createComponent(Ctor, data, context, children, tag);
|
3245
3597
|
} else {
|
@@ -3255,7 +3607,7 @@ function _createElement (
|
|
3255
3607
|
// direct component options / constructor
|
3256
3608
|
vnode = createComponent(tag, data, context, children);
|
3257
3609
|
}
|
3258
|
-
if (vnode) {
|
3610
|
+
if (isDef(vnode)) {
|
3259
3611
|
if (ns) { applyNS(vnode, ns); }
|
3260
3612
|
return vnode
|
3261
3613
|
} else {
|
@@ -3269,10 +3621,10 @@ function applyNS (vnode, ns) {
|
|
3269
3621
|
// use default namespace inside foreignObject
|
3270
3622
|
return
|
3271
3623
|
}
|
3272
|
-
if (vnode.children) {
|
3624
|
+
if (isDef(vnode.children)) {
|
3273
3625
|
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
3274
3626
|
var child = vnode.children[i];
|
3275
|
-
if (child.tag &&
|
3627
|
+
if (isDef(child.tag) && isUndef(child.ns)) {
|
3276
3628
|
applyNS(child, ns);
|
3277
3629
|
}
|
3278
3630
|
}
|
@@ -3391,14 +3743,17 @@ function bindObjectProps (
|
|
3391
3743
|
if (Array.isArray(value)) {
|
3392
3744
|
value = toObject(value);
|
3393
3745
|
}
|
3746
|
+
var hash;
|
3394
3747
|
for (var key in value) {
|
3395
3748
|
if (key === 'class' || key === 'style') {
|
3396
|
-
|
3749
|
+
hash = data;
|
3397
3750
|
} else {
|
3398
3751
|
var type = data.attrs && data.attrs.type;
|
3399
|
-
|
3752
|
+
hash = asProp || config.mustUseProp(tag, type, key)
|
3400
3753
|
? data.domProps || (data.domProps = {})
|
3401
3754
|
: data.attrs || (data.attrs = {});
|
3755
|
+
}
|
3756
|
+
if (!(key in hash)) {
|
3402
3757
|
hash[key] = value[key];
|
3403
3758
|
}
|
3404
3759
|
}
|
@@ -3469,10 +3824,9 @@ function markStaticNode (node, key, isOnce) {
|
|
3469
3824
|
/* */
|
3470
3825
|
|
3471
3826
|
function initRender (vm) {
|
3472
|
-
vm.$vnode = null; // the placeholder node in parent tree
|
3473
3827
|
vm._vnode = null; // the root of the child tree
|
3474
3828
|
vm._staticTrees = null;
|
3475
|
-
var parentVnode = vm.$options._parentVnode;
|
3829
|
+
var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
|
3476
3830
|
var renderContext = parentVnode && parentVnode.context;
|
3477
3831
|
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
|
3478
3832
|
vm.$scopedSlots = emptyObject;
|
@@ -3549,7 +3903,7 @@ function renderMixin (Vue) {
|
|
3549
3903
|
// code size.
|
3550
3904
|
Vue.prototype._o = markOnce;
|
3551
3905
|
Vue.prototype._n = toNumber;
|
3552
|
-
Vue.prototype._s =
|
3906
|
+
Vue.prototype._s = toString;
|
3553
3907
|
Vue.prototype._l = renderList;
|
3554
3908
|
Vue.prototype._t = renderSlot;
|
3555
3909
|
Vue.prototype._q = looseEqual;
|
@@ -3565,53 +3919,22 @@ function renderMixin (Vue) {
|
|
3565
3919
|
|
3566
3920
|
/* */
|
3567
3921
|
|
3568
|
-
|
3569
|
-
var provide = vm.$options.provide;
|
3570
|
-
var inject = vm.$options.inject;
|
3571
|
-
if (provide) {
|
3572
|
-
vm._provided = typeof provide === 'function'
|
3573
|
-
? provide.call(vm)
|
3574
|
-
: provide;
|
3575
|
-
}
|
3576
|
-
if (inject) {
|
3577
|
-
// inject is :any because flow is not smart enough to figure out cached
|
3578
|
-
// isArray here
|
3579
|
-
var isArray = Array.isArray(inject);
|
3580
|
-
var keys = isArray
|
3581
|
-
? inject
|
3582
|
-
: hasSymbol
|
3583
|
-
? Reflect.ownKeys(inject)
|
3584
|
-
: Object.keys(inject);
|
3585
|
-
|
3586
|
-
for (var i = 0; i < keys.length; i++) {
|
3587
|
-
var key = keys[i];
|
3588
|
-
var provideKey = isArray ? key : inject[key];
|
3589
|
-
var source = vm;
|
3590
|
-
while (source) {
|
3591
|
-
if (source._provided && source._provided[provideKey]) {
|
3592
|
-
vm[key] = source._provided[provideKey];
|
3593
|
-
break
|
3594
|
-
}
|
3595
|
-
source = source.$parent;
|
3596
|
-
}
|
3597
|
-
}
|
3598
|
-
}
|
3599
|
-
}
|
3600
|
-
|
3601
|
-
/* */
|
3602
|
-
|
3603
|
-
var uid = 0;
|
3922
|
+
var uid$1 = 0;
|
3604
3923
|
|
3605
3924
|
function initMixin (Vue) {
|
3606
3925
|
Vue.prototype._init = function (options) {
|
3926
|
+
var vm = this;
|
3927
|
+
// a uid
|
3928
|
+
vm._uid = uid$1++;
|
3929
|
+
|
3930
|
+
var startTag, endTag;
|
3607
3931
|
/* istanbul ignore if */
|
3608
|
-
if ("development" !== 'production' && config.performance &&
|
3609
|
-
perf.
|
3932
|
+
if ("development" !== 'production' && config.performance && mark) {
|
3933
|
+
startTag = "vue-perf-init:" + (vm._uid);
|
3934
|
+
endTag = "vue-perf-end:" + (vm._uid);
|
3935
|
+
mark(startTag);
|
3610
3936
|
}
|
3611
3937
|
|
3612
|
-
var vm = this;
|
3613
|
-
// a uid
|
3614
|
-
vm._uid = uid++;
|
3615
3938
|
// a flag to avoid this being observed
|
3616
3939
|
vm._isVue = true;
|
3617
3940
|
// merge options
|
@@ -3637,15 +3960,16 @@ function initMixin (Vue) {
|
|
3637
3960
|
initEvents(vm);
|
3638
3961
|
initRender(vm);
|
3639
3962
|
callHook(vm, 'beforeCreate');
|
3963
|
+
initInjections(vm); // resolve injections before data/props
|
3640
3964
|
initState(vm);
|
3641
|
-
|
3965
|
+
initProvide(vm); // resolve provide after data/props
|
3642
3966
|
callHook(vm, 'created');
|
3643
3967
|
|
3644
3968
|
/* istanbul ignore if */
|
3645
|
-
if ("development" !== 'production' && config.performance &&
|
3969
|
+
if ("development" !== 'production' && config.performance && mark) {
|
3646
3970
|
vm._name = formatComponentName(vm, false);
|
3647
|
-
|
3648
|
-
|
3971
|
+
mark(endTag);
|
3972
|
+
measure(((vm._name) + " init"), startTag, endTag);
|
3649
3973
|
}
|
3650
3974
|
|
3651
3975
|
if (vm.$options.el) {
|
@@ -3698,24 +4022,27 @@ function resolveConstructorOptions (Ctor) {
|
|
3698
4022
|
function resolveModifiedOptions (Ctor) {
|
3699
4023
|
var modified;
|
3700
4024
|
var latest = Ctor.options;
|
4025
|
+
var extended = Ctor.extendOptions;
|
3701
4026
|
var sealed = Ctor.sealedOptions;
|
3702
4027
|
for (var key in latest) {
|
3703
4028
|
if (latest[key] !== sealed[key]) {
|
3704
4029
|
if (!modified) { modified = {}; }
|
3705
|
-
modified[key] = dedupe(latest[key], sealed[key]);
|
4030
|
+
modified[key] = dedupe(latest[key], extended[key], sealed[key]);
|
3706
4031
|
}
|
3707
4032
|
}
|
3708
4033
|
return modified
|
3709
4034
|
}
|
3710
4035
|
|
3711
|
-
function dedupe (latest, sealed) {
|
4036
|
+
function dedupe (latest, extended, sealed) {
|
3712
4037
|
// compare latest and sealed to ensure lifecycle hooks won't be duplicated
|
3713
4038
|
// between merges
|
3714
4039
|
if (Array.isArray(latest)) {
|
3715
4040
|
var res = [];
|
3716
4041
|
sealed = Array.isArray(sealed) ? sealed : [sealed];
|
4042
|
+
extended = Array.isArray(extended) ? extended : [extended];
|
3717
4043
|
for (var i = 0; i < latest.length; i++) {
|
3718
|
-
|
4044
|
+
// push original options and not sealed options to exclude duplicated options
|
4045
|
+
if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
|
3719
4046
|
res.push(latest[i]);
|
3720
4047
|
}
|
3721
4048
|
}
|
@@ -3831,7 +4158,7 @@ function initExtend (Vue) {
|
|
3831
4158
|
|
3832
4159
|
// create asset registers, so extended classes
|
3833
4160
|
// can have their private assets too.
|
3834
|
-
|
4161
|
+
ASSET_TYPES.forEach(function (type) {
|
3835
4162
|
Sub[type] = Super[type];
|
3836
4163
|
});
|
3837
4164
|
// enable recursive self-lookup
|
@@ -3872,7 +4199,7 @@ function initAssetRegisters (Vue) {
|
|
3872
4199
|
/**
|
3873
4200
|
* Create asset registration methods.
|
3874
4201
|
*/
|
3875
|
-
|
4202
|
+
ASSET_TYPES.forEach(function (type) {
|
3876
4203
|
Vue[type] = function (
|
3877
4204
|
id,
|
3878
4205
|
definition
|
@@ -3914,20 +4241,22 @@ function getComponentName (opts) {
|
|
3914
4241
|
function matches (pattern, name) {
|
3915
4242
|
if (typeof pattern === 'string') {
|
3916
4243
|
return pattern.split(',').indexOf(name) > -1
|
3917
|
-
} else if (pattern
|
4244
|
+
} else if (isRegExp(pattern)) {
|
3918
4245
|
return pattern.test(name)
|
3919
4246
|
}
|
3920
4247
|
/* istanbul ignore next */
|
3921
4248
|
return false
|
3922
4249
|
}
|
3923
4250
|
|
3924
|
-
function pruneCache (cache, filter) {
|
4251
|
+
function pruneCache (cache, current, filter) {
|
3925
4252
|
for (var key in cache) {
|
3926
4253
|
var cachedNode = cache[key];
|
3927
4254
|
if (cachedNode) {
|
3928
4255
|
var name = getComponentName(cachedNode.componentOptions);
|
3929
4256
|
if (name && !filter(name)) {
|
3930
|
-
|
4257
|
+
if (cachedNode !== current) {
|
4258
|
+
pruneCacheEntry(cachedNode);
|
4259
|
+
}
|
3931
4260
|
cache[key] = null;
|
3932
4261
|
}
|
3933
4262
|
}
|
@@ -3936,9 +4265,6 @@ function pruneCache (cache, filter) {
|
|
3936
4265
|
|
3937
4266
|
function pruneCacheEntry (vnode) {
|
3938
4267
|
if (vnode) {
|
3939
|
-
if (!vnode.componentInstance._inactive) {
|
3940
|
-
callHook(vnode.componentInstance, 'deactivated');
|
3941
|
-
}
|
3942
4268
|
vnode.componentInstance.$destroy();
|
3943
4269
|
}
|
3944
4270
|
}
|
@@ -3966,10 +4292,10 @@ var KeepAlive = {
|
|
3966
4292
|
|
3967
4293
|
watch: {
|
3968
4294
|
include: function include (val) {
|
3969
|
-
pruneCache(this.cache, function (name) { return matches(val, name); });
|
4295
|
+
pruneCache(this.cache, this._vnode, function (name) { return matches(val, name); });
|
3970
4296
|
},
|
3971
4297
|
exclude: function exclude (val) {
|
3972
|
-
pruneCache(this.cache, function (name) { return !matches(val, name); });
|
4298
|
+
pruneCache(this.cache, this._vnode, function (name) { return !matches(val, name); });
|
3973
4299
|
}
|
3974
4300
|
},
|
3975
4301
|
|
@@ -4035,7 +4361,7 @@ function initGlobalAPI (Vue) {
|
|
4035
4361
|
Vue.nextTick = nextTick;
|
4036
4362
|
|
4037
4363
|
Vue.options = Object.create(null);
|
4038
|
-
|
4364
|
+
ASSET_TYPES.forEach(function (type) {
|
4039
4365
|
Vue.options[type + 's'] = Object.create(null);
|
4040
4366
|
});
|
4041
4367
|
|
@@ -4057,10 +4383,20 @@ Object.defineProperty(Vue$3.prototype, '$isServer', {
|
|
4057
4383
|
get: isServerRendering
|
4058
4384
|
});
|
4059
4385
|
|
4060
|
-
Vue$3.
|
4386
|
+
Object.defineProperty(Vue$3.prototype, '$ssrContext', {
|
4387
|
+
get: function get () {
|
4388
|
+
return this.$vnode.ssrContext
|
4389
|
+
}
|
4390
|
+
});
|
4391
|
+
|
4392
|
+
Vue$3.version = '2.3.2';
|
4061
4393
|
|
4062
4394
|
/* */
|
4063
4395
|
|
4396
|
+
// these are reserved for web because they are directly compiled away
|
4397
|
+
// during template compilation
|
4398
|
+
var isReservedAttr = makeMap('style,class');
|
4399
|
+
|
4064
4400
|
// attributes that should be using props for binding
|
4065
4401
|
var acceptValue = makeMap('input,textarea,option,select');
|
4066
4402
|
var mustUseProp = function (tag, type, attr) {
|
@@ -4103,13 +4439,13 @@ function genClassForVnode (vnode) {
|
|
4103
4439
|
var data = vnode.data;
|
4104
4440
|
var parentNode = vnode;
|
4105
4441
|
var childNode = vnode;
|
4106
|
-
while (childNode.componentInstance) {
|
4442
|
+
while (isDef(childNode.componentInstance)) {
|
4107
4443
|
childNode = childNode.componentInstance._vnode;
|
4108
4444
|
if (childNode.data) {
|
4109
4445
|
data = mergeClassData(childNode.data, data);
|
4110
4446
|
}
|
4111
4447
|
}
|
4112
|
-
while ((parentNode = parentNode.parent)) {
|
4448
|
+
while (isDef(parentNode = parentNode.parent)) {
|
4113
4449
|
if (parentNode.data) {
|
4114
4450
|
data = mergeClassData(data, parentNode.data);
|
4115
4451
|
}
|
@@ -4120,7 +4456,7 @@ function genClassForVnode (vnode) {
|
|
4120
4456
|
function mergeClassData (child, parent) {
|
4121
4457
|
return {
|
4122
4458
|
staticClass: concat(child.staticClass, parent.staticClass),
|
4123
|
-
class: child.class
|
4459
|
+
class: isDef(child.class)
|
4124
4460
|
? [child.class, parent.class]
|
4125
4461
|
: parent.class
|
4126
4462
|
}
|
@@ -4129,7 +4465,7 @@ function mergeClassData (child, parent) {
|
|
4129
4465
|
function genClassFromData (data) {
|
4130
4466
|
var dynamicClass = data.class;
|
4131
4467
|
var staticClass = data.staticClass;
|
4132
|
-
if (staticClass || dynamicClass) {
|
4468
|
+
if (isDef(staticClass) || isDef(dynamicClass)) {
|
4133
4469
|
return concat(staticClass, stringifyClass(dynamicClass))
|
4134
4470
|
}
|
4135
4471
|
/* istanbul ignore next */
|
@@ -4141,18 +4477,18 @@ function concat (a, b) {
|
|
4141
4477
|
}
|
4142
4478
|
|
4143
4479
|
function stringifyClass (value) {
|
4144
|
-
|
4145
|
-
|
4146
|
-
return res
|
4480
|
+
if (isUndef(value)) {
|
4481
|
+
return ''
|
4147
4482
|
}
|
4148
4483
|
if (typeof value === 'string') {
|
4149
4484
|
return value
|
4150
4485
|
}
|
4486
|
+
var res = '';
|
4151
4487
|
if (Array.isArray(value)) {
|
4152
4488
|
var stringified;
|
4153
4489
|
for (var i = 0, l = value.length; i < l; i++) {
|
4154
|
-
if (value[i]) {
|
4155
|
-
if ((stringified = stringifyClass(value[i]))) {
|
4490
|
+
if (isDef(value[i])) {
|
4491
|
+
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
4156
4492
|
res += stringified + ' ';
|
4157
4493
|
}
|
4158
4494
|
}
|
@@ -4395,25 +4731,28 @@ function registerRef (vnode, isRemoval) {
|
|
4395
4731
|
|
4396
4732
|
var emptyNode = new VNode('', {}, []);
|
4397
4733
|
|
4398
|
-
var hooks
|
4399
|
-
|
4400
|
-
function isUndef (s) {
|
4401
|
-
return s == null
|
4402
|
-
}
|
4403
|
-
|
4404
|
-
function isDef (s) {
|
4405
|
-
return s != null
|
4406
|
-
}
|
4734
|
+
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
4407
4735
|
|
4408
|
-
function sameVnode (
|
4736
|
+
function sameVnode (a, b) {
|
4409
4737
|
return (
|
4410
|
-
|
4411
|
-
|
4412
|
-
|
4413
|
-
|
4738
|
+
a.key === b.key &&
|
4739
|
+
a.tag === b.tag &&
|
4740
|
+
a.isComment === b.isComment &&
|
4741
|
+
isDef(a.data) === isDef(b.data) &&
|
4742
|
+
sameInputType(a, b)
|
4414
4743
|
)
|
4415
4744
|
}
|
4416
4745
|
|
4746
|
+
// Some browsers do not support dynamically changing type for <input>
|
4747
|
+
// so they need to be treated as different nodes
|
4748
|
+
function sameInputType (a, b) {
|
4749
|
+
if (a.tag !== 'input') { return true }
|
4750
|
+
var i;
|
4751
|
+
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
4752
|
+
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
4753
|
+
return typeA === typeB
|
4754
|
+
}
|
4755
|
+
|
4417
4756
|
function createKeyToOldIdx (children, beginIdx, endIdx) {
|
4418
4757
|
var i, key;
|
4419
4758
|
var map = {};
|
@@ -4431,10 +4770,12 @@ function createPatchFunction (backend) {
|
|
4431
4770
|
var modules = backend.modules;
|
4432
4771
|
var nodeOps = backend.nodeOps;
|
4433
4772
|
|
4434
|
-
for (i = 0; i < hooks
|
4435
|
-
cbs[hooks
|
4773
|
+
for (i = 0; i < hooks.length; ++i) {
|
4774
|
+
cbs[hooks[i]] = [];
|
4436
4775
|
for (j = 0; j < modules.length; ++j) {
|
4437
|
-
if (modules[j][hooks
|
4776
|
+
if (isDef(modules[j][hooks[i]])) {
|
4777
|
+
cbs[hooks[i]].push(modules[j][hooks[i]]);
|
4778
|
+
}
|
4438
4779
|
}
|
4439
4780
|
}
|
4440
4781
|
|
@@ -4455,7 +4796,7 @@ function createPatchFunction (backend) {
|
|
4455
4796
|
function removeNode (el) {
|
4456
4797
|
var parent = nodeOps.parentNode(el);
|
4457
4798
|
// element may have already been removed due to v-html / v-text
|
4458
|
-
if (parent) {
|
4799
|
+
if (isDef(parent)) {
|
4459
4800
|
nodeOps.removeChild(parent, el);
|
4460
4801
|
}
|
4461
4802
|
}
|
@@ -4506,7 +4847,7 @@ function createPatchFunction (backend) {
|
|
4506
4847
|
if ("development" !== 'production' && data && data.pre) {
|
4507
4848
|
inPre--;
|
4508
4849
|
}
|
4509
|
-
} else if (vnode.isComment) {
|
4850
|
+
} else if (isTrue(vnode.isComment)) {
|
4510
4851
|
vnode.elm = nodeOps.createComment(vnode.text);
|
4511
4852
|
insert(parentElm, vnode.elm, refElm);
|
4512
4853
|
} else {
|
@@ -4528,7 +4869,7 @@ function createPatchFunction (backend) {
|
|
4528
4869
|
// in that case we can just return the element and be done.
|
4529
4870
|
if (isDef(vnode.componentInstance)) {
|
4530
4871
|
initComponent(vnode, insertedVnodeQueue);
|
4531
|
-
if (isReactivated) {
|
4872
|
+
if (isTrue(isReactivated)) {
|
4532
4873
|
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
4533
4874
|
}
|
4534
4875
|
return true
|
@@ -4537,7 +4878,7 @@ function createPatchFunction (backend) {
|
|
4537
4878
|
}
|
4538
4879
|
|
4539
4880
|
function initComponent (vnode, insertedVnodeQueue) {
|
4540
|
-
if (vnode.data.pendingInsert) {
|
4881
|
+
if (isDef(vnode.data.pendingInsert)) {
|
4541
4882
|
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
4542
4883
|
}
|
4543
4884
|
vnode.elm = vnode.componentInstance.$el;
|
@@ -4576,9 +4917,11 @@ function createPatchFunction (backend) {
|
|
4576
4917
|
}
|
4577
4918
|
|
4578
4919
|
function insert (parent, elm, ref) {
|
4579
|
-
if (parent) {
|
4580
|
-
if (ref) {
|
4581
|
-
|
4920
|
+
if (isDef(parent)) {
|
4921
|
+
if (isDef(ref)) {
|
4922
|
+
if (ref.parentNode === parent) {
|
4923
|
+
nodeOps.insertBefore(parent, elm, ref);
|
4924
|
+
}
|
4582
4925
|
} else {
|
4583
4926
|
nodeOps.appendChild(parent, elm);
|
4584
4927
|
}
|
@@ -4608,8 +4951,8 @@ function createPatchFunction (backend) {
|
|
4608
4951
|
}
|
4609
4952
|
i = vnode.data.hook; // Reuse variable
|
4610
4953
|
if (isDef(i)) {
|
4611
|
-
if (i.create) { i.create(emptyNode, vnode); }
|
4612
|
-
if (i.insert) { insertedVnodeQueue.push(vnode); }
|
4954
|
+
if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
4955
|
+
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
4613
4956
|
}
|
4614
4957
|
}
|
4615
4958
|
|
@@ -4668,15 +5011,16 @@ function createPatchFunction (backend) {
|
|
4668
5011
|
}
|
4669
5012
|
|
4670
5013
|
function removeAndInvokeRemoveHook (vnode, rm) {
|
4671
|
-
if (rm || isDef(vnode.data)) {
|
5014
|
+
if (isDef(rm) || isDef(vnode.data)) {
|
5015
|
+
var i;
|
4672
5016
|
var listeners = cbs.remove.length + 1;
|
4673
|
-
if (
|
4674
|
-
// directly removing
|
4675
|
-
rm = createRmCb(vnode.elm, listeners);
|
4676
|
-
} else {
|
5017
|
+
if (isDef(rm)) {
|
4677
5018
|
// we have a recursively passed down rm callback
|
4678
5019
|
// increase the listeners count
|
4679
5020
|
rm.listeners += listeners;
|
5021
|
+
} else {
|
5022
|
+
// directly removing
|
5023
|
+
rm = createRmCb(vnode.elm, listeners);
|
4680
5024
|
}
|
4681
5025
|
// recursively invoke hooks on child component root node
|
4682
5026
|
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
@@ -4778,24 +5122,23 @@ function createPatchFunction (backend) {
|
|
4778
5122
|
// note we only do this if the vnode is cloned -
|
4779
5123
|
// if the new node is not cloned it means the render functions have been
|
4780
5124
|
// reset by the hot-reload-api and we need to do a proper re-render.
|
4781
|
-
if (vnode.isStatic &&
|
4782
|
-
oldVnode.isStatic &&
|
5125
|
+
if (isTrue(vnode.isStatic) &&
|
5126
|
+
isTrue(oldVnode.isStatic) &&
|
4783
5127
|
vnode.key === oldVnode.key &&
|
4784
|
-
(vnode.isCloned || vnode.isOnce)) {
|
5128
|
+
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
|
4785
5129
|
vnode.elm = oldVnode.elm;
|
4786
5130
|
vnode.componentInstance = oldVnode.componentInstance;
|
4787
5131
|
return
|
4788
5132
|
}
|
4789
5133
|
var i;
|
4790
5134
|
var data = vnode.data;
|
4791
|
-
|
4792
|
-
if (hasData && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
5135
|
+
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
4793
5136
|
i(oldVnode, vnode);
|
4794
5137
|
}
|
4795
5138
|
var elm = vnode.elm = oldVnode.elm;
|
4796
5139
|
var oldCh = oldVnode.children;
|
4797
5140
|
var ch = vnode.children;
|
4798
|
-
if (
|
5141
|
+
if (isDef(data) && isPatchable(vnode)) {
|
4799
5142
|
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
4800
5143
|
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
4801
5144
|
}
|
@@ -4813,7 +5156,7 @@ function createPatchFunction (backend) {
|
|
4813
5156
|
} else if (oldVnode.text !== vnode.text) {
|
4814
5157
|
nodeOps.setTextContent(elm, vnode.text);
|
4815
5158
|
}
|
4816
|
-
if (
|
5159
|
+
if (isDef(data)) {
|
4817
5160
|
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
4818
5161
|
}
|
4819
5162
|
}
|
@@ -4821,7 +5164,7 @@ function createPatchFunction (backend) {
|
|
4821
5164
|
function invokeInsertHook (vnode, queue, initial) {
|
4822
5165
|
// delay insert hooks for component root nodes, invoke them after the
|
4823
5166
|
// element is really inserted
|
4824
|
-
if (initial && vnode.parent) {
|
5167
|
+
if (isTrue(initial) && isDef(vnode.parent)) {
|
4825
5168
|
vnode.parent.data.pendingInsert = queue;
|
4826
5169
|
} else {
|
4827
5170
|
for (var i = 0; i < queue.length; ++i) {
|
@@ -4898,7 +5241,7 @@ function createPatchFunction (backend) {
|
|
4898
5241
|
}
|
4899
5242
|
|
4900
5243
|
function assertNodeMatch (node, vnode) {
|
4901
|
-
if (vnode.tag) {
|
5244
|
+
if (isDef(vnode.tag)) {
|
4902
5245
|
return (
|
4903
5246
|
vnode.tag.indexOf('vue-component') === 0 ||
|
4904
5247
|
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
@@ -4909,15 +5252,15 @@ function createPatchFunction (backend) {
|
|
4909
5252
|
}
|
4910
5253
|
|
4911
5254
|
return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
|
4912
|
-
if (
|
4913
|
-
if (oldVnode) { invokeDestroyHook(oldVnode); }
|
5255
|
+
if (isUndef(vnode)) {
|
5256
|
+
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
4914
5257
|
return
|
4915
5258
|
}
|
4916
5259
|
|
4917
5260
|
var isInitialPatch = false;
|
4918
5261
|
var insertedVnodeQueue = [];
|
4919
5262
|
|
4920
|
-
if (
|
5263
|
+
if (isUndef(oldVnode)) {
|
4921
5264
|
// empty mount (likely as component), create new root element
|
4922
5265
|
isInitialPatch = true;
|
4923
5266
|
createElm(vnode, insertedVnodeQueue, parentElm, refElm);
|
@@ -4931,11 +5274,11 @@ function createPatchFunction (backend) {
|
|
4931
5274
|
// mounting to a real element
|
4932
5275
|
// check if this is server-rendered content and if we can perform
|
4933
5276
|
// a successful hydration.
|
4934
|
-
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(
|
4935
|
-
oldVnode.removeAttribute(
|
5277
|
+
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
5278
|
+
oldVnode.removeAttribute(SSR_ATTR);
|
4936
5279
|
hydrating = true;
|
4937
5280
|
}
|
4938
|
-
if (hydrating) {
|
5281
|
+
if (isTrue(hydrating)) {
|
4939
5282
|
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
4940
5283
|
invokeInsertHook(vnode, insertedVnodeQueue, true);
|
4941
5284
|
return oldVnode
|
@@ -4966,7 +5309,7 @@ function createPatchFunction (backend) {
|
|
4966
5309
|
nodeOps.nextSibling(oldElm)
|
4967
5310
|
);
|
4968
5311
|
|
4969
|
-
if (vnode.parent) {
|
5312
|
+
if (isDef(vnode.parent)) {
|
4970
5313
|
// component root element replaced.
|
4971
5314
|
// update parent placeholder node element, recursively
|
4972
5315
|
var ancestor = vnode.parent;
|
@@ -4981,7 +5324,7 @@ function createPatchFunction (backend) {
|
|
4981
5324
|
}
|
4982
5325
|
}
|
4983
5326
|
|
4984
|
-
if (parentElm$1
|
5327
|
+
if (isDef(parentElm$1)) {
|
4985
5328
|
removeVnodes(parentElm$1, [oldVnode], 0, 0);
|
4986
5329
|
} else if (isDef(oldVnode.tag)) {
|
4987
5330
|
invokeDestroyHook(oldVnode);
|
@@ -5099,7 +5442,11 @@ function getRawDirName (dir) {
|
|
5099
5442
|
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
5100
5443
|
var fn = dir.def && dir.def[hook];
|
5101
5444
|
if (fn) {
|
5102
|
-
|
5445
|
+
try {
|
5446
|
+
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
5447
|
+
} catch (e) {
|
5448
|
+
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
5449
|
+
}
|
5103
5450
|
}
|
5104
5451
|
}
|
5105
5452
|
|
@@ -5111,7 +5458,7 @@ var baseModules = [
|
|
5111
5458
|
/* */
|
5112
5459
|
|
5113
5460
|
function updateAttrs (oldVnode, vnode) {
|
5114
|
-
if (
|
5461
|
+
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
5115
5462
|
return
|
5116
5463
|
}
|
5117
5464
|
var key, cur, old;
|
@@ -5119,7 +5466,7 @@ function updateAttrs (oldVnode, vnode) {
|
|
5119
5466
|
var oldAttrs = oldVnode.data.attrs || {};
|
5120
5467
|
var attrs = vnode.data.attrs || {};
|
5121
5468
|
// clone observed objects, as the user probably wants to mutate it
|
5122
|
-
if (attrs.__ob__) {
|
5469
|
+
if (isDef(attrs.__ob__)) {
|
5123
5470
|
attrs = vnode.data.attrs = extend({}, attrs);
|
5124
5471
|
}
|
5125
5472
|
|
@@ -5136,7 +5483,7 @@ function updateAttrs (oldVnode, vnode) {
|
|
5136
5483
|
setAttr(elm, 'value', attrs.value);
|
5137
5484
|
}
|
5138
5485
|
for (key in oldAttrs) {
|
5139
|
-
if (attrs[key]
|
5486
|
+
if (isUndef(attrs[key])) {
|
5140
5487
|
if (isXlink(key)) {
|
5141
5488
|
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
5142
5489
|
} else if (!isEnumeratedAttr(key)) {
|
@@ -5183,8 +5530,15 @@ function updateClass (oldVnode, vnode) {
|
|
5183
5530
|
var el = vnode.elm;
|
5184
5531
|
var data = vnode.data;
|
5185
5532
|
var oldData = oldVnode.data;
|
5186
|
-
if (
|
5187
|
-
|
5533
|
+
if (
|
5534
|
+
isUndef(data.staticClass) &&
|
5535
|
+
isUndef(data.class) && (
|
5536
|
+
isUndef(oldData) || (
|
5537
|
+
isUndef(oldData.staticClass) &&
|
5538
|
+
isUndef(oldData.class)
|
5539
|
+
)
|
5540
|
+
)
|
5541
|
+
) {
|
5188
5542
|
return
|
5189
5543
|
}
|
5190
5544
|
|
@@ -5192,7 +5546,7 @@ function updateClass (oldVnode, vnode) {
|
|
5192
5546
|
|
5193
5547
|
// handle transition classes
|
5194
5548
|
var transitionClass = el._transitionClasses;
|
5195
|
-
if (transitionClass) {
|
5549
|
+
if (isDef(transitionClass)) {
|
5196
5550
|
cls = concat(cls, stringifyClass(transitionClass));
|
5197
5551
|
}
|
5198
5552
|
|
@@ -5345,8 +5699,20 @@ function addHandler (
|
|
5345
5699
|
name,
|
5346
5700
|
value,
|
5347
5701
|
modifiers,
|
5348
|
-
important
|
5702
|
+
important,
|
5703
|
+
warn
|
5349
5704
|
) {
|
5705
|
+
// warn prevent and passive modifier
|
5706
|
+
/* istanbul ignore if */
|
5707
|
+
if (
|
5708
|
+
"development" !== 'production' && warn &&
|
5709
|
+
modifiers && modifiers.prevent && modifiers.passive
|
5710
|
+
) {
|
5711
|
+
warn(
|
5712
|
+
'passive and prevent can\'t be used together. ' +
|
5713
|
+
'Passive handler can\'t prevent default event.'
|
5714
|
+
);
|
5715
|
+
}
|
5350
5716
|
// check capture modifier
|
5351
5717
|
if (modifiers && modifiers.capture) {
|
5352
5718
|
delete modifiers.capture;
|
@@ -5356,6 +5722,11 @@ function addHandler (
|
|
5356
5722
|
delete modifiers.once;
|
5357
5723
|
name = '~' + name; // mark the event as once
|
5358
5724
|
}
|
5725
|
+
/* istanbul ignore if */
|
5726
|
+
if (modifiers && modifiers.passive) {
|
5727
|
+
delete modifiers.passive;
|
5728
|
+
name = '&' + name; // mark the event as passive
|
5729
|
+
}
|
5359
5730
|
var events;
|
5360
5731
|
if (modifiers && modifiers.native) {
|
5361
5732
|
delete modifiers.native;
|
@@ -5436,6 +5807,7 @@ function genComponentModel (
|
|
5436
5807
|
|
5437
5808
|
el.model = {
|
5438
5809
|
value: ("(" + value + ")"),
|
5810
|
+
expression: ("\"" + value + "\""),
|
5439
5811
|
callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
5440
5812
|
};
|
5441
5813
|
}
|
@@ -5615,14 +5987,6 @@ function genCheckboxModel (
|
|
5615
5987
|
value,
|
5616
5988
|
modifiers
|
5617
5989
|
) {
|
5618
|
-
if ("development" !== 'production' &&
|
5619
|
-
el.attrsMap.checked != null) {
|
5620
|
-
warn$1(
|
5621
|
-
"<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
|
5622
|
-
"inline checked attributes will be ignored when using v-model. " +
|
5623
|
-
'Declare initial values in the component\'s data option instead.'
|
5624
|
-
);
|
5625
|
-
}
|
5626
5990
|
var number = modifiers && modifiers.number;
|
5627
5991
|
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
5628
5992
|
var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
@@ -5644,7 +6008,7 @@ function genCheckboxModel (
|
|
5644
6008
|
'$$i=_i($$a,$$v);' +
|
5645
6009
|
"if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
|
5646
6010
|
"else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
|
5647
|
-
"}else{" + value + "
|
6011
|
+
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
|
5648
6012
|
null, true
|
5649
6013
|
);
|
5650
6014
|
}
|
@@ -5654,14 +6018,6 @@ function genRadioModel (
|
|
5654
6018
|
value,
|
5655
6019
|
modifiers
|
5656
6020
|
) {
|
5657
|
-
if ("development" !== 'production' &&
|
5658
|
-
el.attrsMap.checked != null) {
|
5659
|
-
warn$1(
|
5660
|
-
"<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
|
5661
|
-
"inline checked attributes will be ignored when using v-model. " +
|
5662
|
-
'Declare initial values in the component\'s data option instead.'
|
5663
|
-
);
|
5664
|
-
}
|
5665
6021
|
var number = modifiers && modifiers.number;
|
5666
6022
|
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
5667
6023
|
valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
@@ -5674,10 +6030,6 @@ function genSelect (
|
|
5674
6030
|
value,
|
5675
6031
|
modifiers
|
5676
6032
|
) {
|
5677
|
-
{
|
5678
|
-
el.children.some(checkOptionWarning);
|
5679
|
-
}
|
5680
|
-
|
5681
6033
|
var number = modifiers && modifiers.number;
|
5682
6034
|
var selectedVal = "Array.prototype.filter" +
|
5683
6035
|
".call($event.target.options,function(o){return o.selected})" +
|
@@ -5690,20 +6042,6 @@ function genSelect (
|
|
5690
6042
|
addHandler(el, 'change', code, null, true);
|
5691
6043
|
}
|
5692
6044
|
|
5693
|
-
function checkOptionWarning (option) {
|
5694
|
-
if (option.type === 1 &&
|
5695
|
-
option.tag === 'option' &&
|
5696
|
-
option.attrsMap.selected != null) {
|
5697
|
-
warn$1(
|
5698
|
-
"<select v-model=\"" + (option.parent.attrsMap['v-model']) + "\">:\n" +
|
5699
|
-
'inline selected attributes on <option> will be ignored when using v-model. ' +
|
5700
|
-
'Declare initial values in the component\'s data option instead.'
|
5701
|
-
);
|
5702
|
-
return true
|
5703
|
-
}
|
5704
|
-
return false
|
5705
|
-
}
|
5706
|
-
|
5707
6045
|
function genDefaultModel (
|
5708
6046
|
el,
|
5709
6047
|
value,
|
@@ -5750,13 +6088,13 @@ function genDefaultModel (
|
|
5750
6088
|
function normalizeEvents (on) {
|
5751
6089
|
var event;
|
5752
6090
|
/* istanbul ignore if */
|
5753
|
-
if (on[RANGE_TOKEN]) {
|
6091
|
+
if (isDef(on[RANGE_TOKEN])) {
|
5754
6092
|
// IE input[type=range] only supports `change` event
|
5755
6093
|
event = isIE ? 'change' : 'input';
|
5756
6094
|
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
5757
6095
|
delete on[RANGE_TOKEN];
|
5758
6096
|
}
|
5759
|
-
if (on[CHECKBOX_RADIO_TOKEN]) {
|
6097
|
+
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
5760
6098
|
// Chrome fires microtasks in between click/change, leads to #4521
|
5761
6099
|
event = isChrome ? 'click' : 'change';
|
5762
6100
|
on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
|
@@ -5769,10 +6107,11 @@ var target$1;
|
|
5769
6107
|
function add$1 (
|
5770
6108
|
event,
|
5771
6109
|
handler,
|
5772
|
-
once,
|
5773
|
-
capture
|
6110
|
+
once$$1,
|
6111
|
+
capture,
|
6112
|
+
passive
|
5774
6113
|
) {
|
5775
|
-
if (once) {
|
6114
|
+
if (once$$1) {
|
5776
6115
|
var oldHandler = handler;
|
5777
6116
|
var _target = target$1; // save current target element in closure
|
5778
6117
|
handler = function (ev) {
|
@@ -5784,7 +6123,13 @@ function add$1 (
|
|
5784
6123
|
}
|
5785
6124
|
};
|
5786
6125
|
}
|
5787
|
-
target$1.addEventListener(
|
6126
|
+
target$1.addEventListener(
|
6127
|
+
event,
|
6128
|
+
handler,
|
6129
|
+
supportsPassive
|
6130
|
+
? { capture: capture, passive: passive }
|
6131
|
+
: capture
|
6132
|
+
);
|
5788
6133
|
}
|
5789
6134
|
|
5790
6135
|
function remove$2 (
|
@@ -5797,7 +6142,7 @@ function remove$2 (
|
|
5797
6142
|
}
|
5798
6143
|
|
5799
6144
|
function updateDOMListeners (oldVnode, vnode) {
|
5800
|
-
if (
|
6145
|
+
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
5801
6146
|
return
|
5802
6147
|
}
|
5803
6148
|
var on = vnode.data.on || {};
|
@@ -5815,7 +6160,7 @@ var events = {
|
|
5815
6160
|
/* */
|
5816
6161
|
|
5817
6162
|
function updateDOMProps (oldVnode, vnode) {
|
5818
|
-
if (
|
6163
|
+
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
5819
6164
|
return
|
5820
6165
|
}
|
5821
6166
|
var key, cur;
|
@@ -5823,12 +6168,12 @@ function updateDOMProps (oldVnode, vnode) {
|
|
5823
6168
|
var oldProps = oldVnode.data.domProps || {};
|
5824
6169
|
var props = vnode.data.domProps || {};
|
5825
6170
|
// clone observed objects, as the user probably wants to mutate it
|
5826
|
-
if (props.__ob__) {
|
6171
|
+
if (isDef(props.__ob__)) {
|
5827
6172
|
props = vnode.data.domProps = extend({}, props);
|
5828
6173
|
}
|
5829
6174
|
|
5830
6175
|
for (key in oldProps) {
|
5831
|
-
if (props[key]
|
6176
|
+
if (isUndef(props[key])) {
|
5832
6177
|
elm[key] = '';
|
5833
6178
|
}
|
5834
6179
|
}
|
@@ -5847,7 +6192,7 @@ function updateDOMProps (oldVnode, vnode) {
|
|
5847
6192
|
// non-string values will be stringified
|
5848
6193
|
elm._value = cur;
|
5849
6194
|
// avoid resetting cursor position when value is the same
|
5850
|
-
var strCur = cur
|
6195
|
+
var strCur = isUndef(cur) ? '' : String(cur);
|
5851
6196
|
if (shouldUpdateValue(elm, vnode, strCur)) {
|
5852
6197
|
elm.value = strCur;
|
5853
6198
|
}
|
@@ -5880,10 +6225,10 @@ function isDirty (elm, checkVal) {
|
|
5880
6225
|
function isInputChanged (elm, newVal) {
|
5881
6226
|
var value = elm.value;
|
5882
6227
|
var modifiers = elm._vModifiers; // injected by v-model runtime
|
5883
|
-
if ((modifiers && modifiers.number) || elm.type === 'number') {
|
6228
|
+
if ((isDef(modifiers) && modifiers.number) || elm.type === 'number') {
|
5884
6229
|
return toNumber(value) !== toNumber(newVal)
|
5885
6230
|
}
|
5886
|
-
if (modifiers && modifiers.trim) {
|
6231
|
+
if (isDef(modifiers) && modifiers.trim) {
|
5887
6232
|
return value.trim() !== newVal.trim()
|
5888
6233
|
}
|
5889
6234
|
return value !== newVal
|
@@ -5972,7 +6317,17 @@ var setProp = function (el, name, val) {
|
|
5972
6317
|
} else if (importantRE.test(val)) {
|
5973
6318
|
el.style.setProperty(name, val.replace(importantRE, ''), 'important');
|
5974
6319
|
} else {
|
5975
|
-
|
6320
|
+
var normalizedName = normalize(name);
|
6321
|
+
if (Array.isArray(val)) {
|
6322
|
+
// Support values array created by autoprefixer, e.g.
|
6323
|
+
// {display: ["-webkit-box", "-ms-flexbox", "flex"]}
|
6324
|
+
// Set them one by one, and the browser will only set those it can recognize
|
6325
|
+
for (var i = 0, len = val.length; i < len; i++) {
|
6326
|
+
el.style[normalizedName] = val[i];
|
6327
|
+
}
|
6328
|
+
} else {
|
6329
|
+
el.style[normalizedName] = val;
|
6330
|
+
}
|
5976
6331
|
}
|
5977
6332
|
};
|
5978
6333
|
|
@@ -5998,27 +6353,32 @@ function updateStyle (oldVnode, vnode) {
|
|
5998
6353
|
var data = vnode.data;
|
5999
6354
|
var oldData = oldVnode.data;
|
6000
6355
|
|
6001
|
-
if (
|
6002
|
-
|
6356
|
+
if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
6357
|
+
isUndef(oldData.staticStyle) && isUndef(oldData.style)) {
|
6003
6358
|
return
|
6004
6359
|
}
|
6005
6360
|
|
6006
6361
|
var cur, name;
|
6007
6362
|
var el = vnode.elm;
|
6008
|
-
var oldStaticStyle =
|
6009
|
-
var oldStyleBinding =
|
6363
|
+
var oldStaticStyle = oldData.staticStyle;
|
6364
|
+
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
6010
6365
|
|
6011
6366
|
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
|
6012
6367
|
var oldStyle = oldStaticStyle || oldStyleBinding;
|
6013
6368
|
|
6014
6369
|
var style = normalizeStyleBinding(vnode.data.style) || {};
|
6015
6370
|
|
6016
|
-
|
6371
|
+
// store normalized style under a different key for next diff
|
6372
|
+
// make sure to clone it if it's reactive, since the user likley wants
|
6373
|
+
// to mutate it.
|
6374
|
+
vnode.data.normalizedStyle = isDef(style.__ob__)
|
6375
|
+
? extend({}, style)
|
6376
|
+
: style;
|
6017
6377
|
|
6018
6378
|
var newStyle = getStyle(vnode, true);
|
6019
6379
|
|
6020
6380
|
for (name in oldStyle) {
|
6021
|
-
if (newStyle[name]
|
6381
|
+
if (isUndef(newStyle[name])) {
|
6022
6382
|
setProp(el, name, '');
|
6023
6383
|
}
|
6024
6384
|
}
|
@@ -6201,9 +6561,9 @@ var transformRE = /\b(transform|all)(,|$)/;
|
|
6201
6561
|
|
6202
6562
|
function getTransitionInfo (el, expectedType) {
|
6203
6563
|
var styles = window.getComputedStyle(el);
|
6204
|
-
var
|
6564
|
+
var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
|
6205
6565
|
var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
|
6206
|
-
var transitionTimeout = getTimeout(
|
6566
|
+
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
6207
6567
|
var animationDelays = styles[animationProp + 'Delay'].split(', ');
|
6208
6568
|
var animationDurations = styles[animationProp + 'Duration'].split(', ');
|
6209
6569
|
var animationTimeout = getTimeout(animationDelays, animationDurations);
|
@@ -6269,18 +6629,18 @@ function enter (vnode, toggleDisplay) {
|
|
6269
6629
|
var el = vnode.elm;
|
6270
6630
|
|
6271
6631
|
// call leave callback now
|
6272
|
-
if (el._leaveCb) {
|
6632
|
+
if (isDef(el._leaveCb)) {
|
6273
6633
|
el._leaveCb.cancelled = true;
|
6274
6634
|
el._leaveCb();
|
6275
6635
|
}
|
6276
6636
|
|
6277
6637
|
var data = resolveTransition(vnode.data.transition);
|
6278
|
-
if (
|
6638
|
+
if (isUndef(data)) {
|
6279
6639
|
return
|
6280
6640
|
}
|
6281
6641
|
|
6282
6642
|
/* istanbul ignore if */
|
6283
|
-
if (el._enterCb || el.nodeType !== 1) {
|
6643
|
+
if (isDef(el._enterCb) || el.nodeType !== 1) {
|
6284
6644
|
return
|
6285
6645
|
}
|
6286
6646
|
|
@@ -6353,7 +6713,7 @@ function enter (vnode, toggleDisplay) {
|
|
6353
6713
|
}
|
6354
6714
|
|
6355
6715
|
var expectsCSS = css !== false && !isIE9;
|
6356
|
-
var userWantsControl =
|
6716
|
+
var userWantsControl = getHookArgumentsLength(enterHook);
|
6357
6717
|
|
6358
6718
|
var cb = el._enterCb = once(function () {
|
6359
6719
|
if (expectsCSS) {
|
@@ -6417,18 +6777,18 @@ function leave (vnode, rm) {
|
|
6417
6777
|
var el = vnode.elm;
|
6418
6778
|
|
6419
6779
|
// call enter callback now
|
6420
|
-
if (el._enterCb) {
|
6780
|
+
if (isDef(el._enterCb)) {
|
6421
6781
|
el._enterCb.cancelled = true;
|
6422
6782
|
el._enterCb();
|
6423
6783
|
}
|
6424
6784
|
|
6425
6785
|
var data = resolveTransition(vnode.data.transition);
|
6426
|
-
if (
|
6786
|
+
if (isUndef(data)) {
|
6427
6787
|
return rm()
|
6428
6788
|
}
|
6429
6789
|
|
6430
6790
|
/* istanbul ignore if */
|
6431
|
-
if (el._leaveCb || el.nodeType !== 1) {
|
6791
|
+
if (isDef(el._leaveCb) || el.nodeType !== 1) {
|
6432
6792
|
return
|
6433
6793
|
}
|
6434
6794
|
|
@@ -6445,7 +6805,7 @@ function leave (vnode, rm) {
|
|
6445
6805
|
var duration = data.duration;
|
6446
6806
|
|
6447
6807
|
var expectsCSS = css !== false && !isIE9;
|
6448
|
-
var userWantsControl =
|
6808
|
+
var userWantsControl = getHookArgumentsLength(leave);
|
6449
6809
|
|
6450
6810
|
var explicitLeaveDuration = toNumber(
|
6451
6811
|
isObject(duration)
|
@@ -6453,7 +6813,7 @@ function leave (vnode, rm) {
|
|
6453
6813
|
: duration
|
6454
6814
|
);
|
6455
6815
|
|
6456
|
-
if ("development" !== 'production' && explicitLeaveDuration
|
6816
|
+
if ("development" !== 'production' && isDef(explicitLeaveDuration)) {
|
6457
6817
|
checkDuration(explicitLeaveDuration, 'leave', vnode);
|
6458
6818
|
}
|
6459
6819
|
|
@@ -6490,7 +6850,7 @@ function leave (vnode, rm) {
|
|
6490
6850
|
}
|
6491
6851
|
// record leaving element
|
6492
6852
|
if (!vnode.data.show) {
|
6493
|
-
(el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
|
6853
|
+
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
6494
6854
|
}
|
6495
6855
|
beforeLeave && beforeLeave(el);
|
6496
6856
|
if (expectsCSS) {
|
@@ -6542,12 +6902,14 @@ function isValidDuration (val) {
|
|
6542
6902
|
* - a wrapped component method (check ._length)
|
6543
6903
|
* - a plain function (.length)
|
6544
6904
|
*/
|
6545
|
-
function
|
6546
|
-
if (
|
6905
|
+
function getHookArgumentsLength (fn) {
|
6906
|
+
if (isUndef(fn)) {
|
6907
|
+
return false
|
6908
|
+
}
|
6547
6909
|
var invokerFns = fn.fns;
|
6548
|
-
if (invokerFns) {
|
6910
|
+
if (isDef(invokerFns)) {
|
6549
6911
|
// invoker
|
6550
|
-
return
|
6912
|
+
return getHookArgumentsLength(
|
6551
6913
|
Array.isArray(invokerFns)
|
6552
6914
|
? invokerFns[0]
|
6553
6915
|
: invokerFns
|
@@ -6558,7 +6920,7 @@ function getHookAgumentsLength (fn) {
|
|
6558
6920
|
}
|
6559
6921
|
|
6560
6922
|
function _enter (_, vnode) {
|
6561
|
-
if (
|
6923
|
+
if (vnode.data.show !== true) {
|
6562
6924
|
enter(vnode);
|
6563
6925
|
}
|
6564
6926
|
}
|
@@ -6568,7 +6930,7 @@ var transition = inBrowser ? {
|
|
6568
6930
|
activate: _enter,
|
6569
6931
|
remove: function remove$$1 (vnode, rm) {
|
6570
6932
|
/* istanbul ignore else */
|
6571
|
-
if (
|
6933
|
+
if (vnode.data.show !== true) {
|
6572
6934
|
leave(vnode, rm);
|
6573
6935
|
} else {
|
6574
6936
|
rm();
|
@@ -6620,9 +6982,14 @@ var model$1 = {
|
|
6620
6982
|
if (isIE || isEdge) {
|
6621
6983
|
setTimeout(cb, 0);
|
6622
6984
|
}
|
6623
|
-
} else if (vnode.tag === 'textarea' || el.type === 'text') {
|
6985
|
+
} else if (vnode.tag === 'textarea' || el.type === 'text' || el.type === 'password') {
|
6624
6986
|
el._vModifiers = binding.modifiers;
|
6625
6987
|
if (!binding.modifiers.lazy) {
|
6988
|
+
// Safari < 10.2 & UIWebView doesn't fire compositionend when
|
6989
|
+
// switching focus before confirming composition choice
|
6990
|
+
// this also fixes the issue where some browsers e.g. iOS Chrome
|
6991
|
+
// fires "change" instead of "input" on autocomplete.
|
6992
|
+
el.addEventListener('change', onCompositionEnd);
|
6626
6993
|
if (!isAndroid) {
|
6627
6994
|
el.addEventListener('compositionstart', onCompositionStart);
|
6628
6995
|
el.addEventListener('compositionend', onCompositionEnd);
|
@@ -6834,9 +7201,11 @@ function extractTransitionData (comp) {
|
|
6834
7201
|
}
|
6835
7202
|
|
6836
7203
|
function placeholder (h, rawChild) {
|
6837
|
-
|
6838
|
-
|
6839
|
-
|
7204
|
+
if (/\d-keep-alive$/.test(rawChild.tag)) {
|
7205
|
+
return h('keep-alive', {
|
7206
|
+
props: rawChild.componentOptions.propsData
|
7207
|
+
})
|
7208
|
+
}
|
6840
7209
|
}
|
6841
7210
|
|
6842
7211
|
function hasParentTransition (vnode) {
|
@@ -6967,7 +7336,7 @@ var Transition = {
|
|
6967
7336
|
// we force transition-group to update its children into two passes:
|
6968
7337
|
// in the first pass, we remove all nodes that need to be removed,
|
6969
7338
|
// triggering their leaving transition; in the second pass, we insert/move
|
6970
|
-
// into the final
|
7339
|
+
// into the final desired state. This way in the second pass removed
|
6971
7340
|
// nodes will remain where they should be.
|
6972
7341
|
|
6973
7342
|
var props = extend({
|
@@ -7134,6 +7503,7 @@ var platformComponents = {
|
|
7134
7503
|
// install platform specific utils
|
7135
7504
|
Vue$3.config.mustUseProp = mustUseProp;
|
7136
7505
|
Vue$3.config.isReservedTag = isReservedTag;
|
7506
|
+
Vue$3.config.isReservedAttr = isReservedAttr;
|
7137
7507
|
Vue$3.config.getTagNamespace = getTagNamespace;
|
7138
7508
|
Vue$3.config.isUnknownElement = isUnknownElement;
|
7139
7509
|
|
@@ -7194,15 +7564,13 @@ var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', ' ') : false;
|
|
7194
7564
|
|
7195
7565
|
var isUnaryTag = makeMap(
|
7196
7566
|
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
7197
|
-
'link,meta,param,source,track,wbr'
|
7198
|
-
true
|
7567
|
+
'link,meta,param,source,track,wbr'
|
7199
7568
|
);
|
7200
7569
|
|
7201
7570
|
// Elements that you can, intentionally, leave open
|
7202
7571
|
// (and which close themselves)
|
7203
7572
|
var canBeLeftOpenTag = makeMap(
|
7204
|
-
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
7205
|
-
true
|
7573
|
+
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
7206
7574
|
);
|
7207
7575
|
|
7208
7576
|
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
@@ -7212,8 +7580,7 @@ var isNonPhrasingTag = makeMap(
|
|
7212
7580
|
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
7213
7581
|
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
7214
7582
|
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
7215
|
-
'title,tr,track'
|
7216
|
-
true
|
7583
|
+
'title,tr,track'
|
7217
7584
|
);
|
7218
7585
|
|
7219
7586
|
/* */
|
@@ -7271,7 +7638,7 @@ var IS_REGEX_CAPTURING_BROKEN = false;
|
|
7271
7638
|
});
|
7272
7639
|
|
7273
7640
|
// Special Elements (can contain anything)
|
7274
|
-
var
|
7641
|
+
var isPlainTextElement = makeMap('script,style,textarea', true);
|
7275
7642
|
var reCache = {};
|
7276
7643
|
|
7277
7644
|
var decodingMap = {
|
@@ -7293,12 +7660,13 @@ function parseHTML (html, options) {
|
|
7293
7660
|
var stack = [];
|
7294
7661
|
var expectHTML = options.expectHTML;
|
7295
7662
|
var isUnaryTag$$1 = options.isUnaryTag || no;
|
7663
|
+
var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
7296
7664
|
var index = 0;
|
7297
7665
|
var last, lastTag;
|
7298
7666
|
while (html) {
|
7299
7667
|
last = html;
|
7300
|
-
// Make sure we're not in a
|
7301
|
-
if (!lastTag || !
|
7668
|
+
// Make sure we're not in a plaintext content element like script/style
|
7669
|
+
if (!lastTag || !isPlainTextElement(lastTag)) {
|
7302
7670
|
var textEnd = html.indexOf('<');
|
7303
7671
|
if (textEnd === 0) {
|
7304
7672
|
// Comment:
|
@@ -7378,7 +7746,7 @@ function parseHTML (html, options) {
|
|
7378
7746
|
var endTagLength = 0;
|
7379
7747
|
var rest = html.replace(reStackedTag, function (all, text, endTag) {
|
7380
7748
|
endTagLength = endTag.length;
|
7381
|
-
if (stackedTag
|
7749
|
+
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
7382
7750
|
text = text
|
7383
7751
|
.replace(/<!--([\s\S]*?)-->/g, '$1')
|
7384
7752
|
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
@@ -7441,7 +7809,7 @@ function parseHTML (html, options) {
|
|
7441
7809
|
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
7442
7810
|
parseEndTag(lastTag);
|
7443
7811
|
}
|
7444
|
-
if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
|
7812
|
+
if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
7445
7813
|
parseEndTag(tagName);
|
7446
7814
|
}
|
7447
7815
|
}
|
@@ -7573,25 +7941,26 @@ function parseText (
|
|
7573
7941
|
|
7574
7942
|
/* */
|
7575
7943
|
|
7944
|
+
var onRE = /^@|^v-on:/;
|
7576
7945
|
var dirRE = /^v-|^@|^:/;
|
7577
7946
|
var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
|
7578
7947
|
var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
|
7579
|
-
|
7580
|
-
var onRE = /^@|^v-on:/;
|
7948
|
+
|
7581
7949
|
var argRE = /:(.*)$/;
|
7950
|
+
var bindRE = /^:|^v-bind:/;
|
7582
7951
|
var modifierRE = /\.[^.]+/g;
|
7583
7952
|
|
7584
7953
|
var decodeHTMLCached = cached(decode);
|
7585
7954
|
|
7586
7955
|
// configurable state
|
7587
7956
|
var warn$2;
|
7588
|
-
var
|
7589
|
-
var platformMustUseProp;
|
7590
|
-
var platformIsPreTag;
|
7591
|
-
var preTransforms;
|
7957
|
+
var delimiters;
|
7592
7958
|
var transforms;
|
7959
|
+
var preTransforms;
|
7593
7960
|
var postTransforms;
|
7594
|
-
var
|
7961
|
+
var platformIsPreTag;
|
7962
|
+
var platformMustUseProp;
|
7963
|
+
var platformGetTagNamespace;
|
7595
7964
|
|
7596
7965
|
/**
|
7597
7966
|
* Convert HTML string to AST.
|
@@ -7617,6 +7986,13 @@ function parse (
|
|
7617
7986
|
var inPre = false;
|
7618
7987
|
var warned = false;
|
7619
7988
|
|
7989
|
+
function warnOnce (msg) {
|
7990
|
+
if (!warned) {
|
7991
|
+
warned = true;
|
7992
|
+
warn$2(msg);
|
7993
|
+
}
|
7994
|
+
}
|
7995
|
+
|
7620
7996
|
function endPre (element) {
|
7621
7997
|
// check pre state
|
7622
7998
|
if (element.pre) {
|
@@ -7631,6 +8007,7 @@ function parse (
|
|
7631
8007
|
warn: warn$2,
|
7632
8008
|
expectHTML: options.expectHTML,
|
7633
8009
|
isUnaryTag: options.isUnaryTag,
|
8010
|
+
canBeLeftOpenTag: options.canBeLeftOpenTag,
|
7634
8011
|
shouldDecodeNewlines: options.shouldDecodeNewlines,
|
7635
8012
|
start: function start (tag, attrs, unary) {
|
7636
8013
|
// check namespace.
|
@@ -7700,17 +8077,15 @@ function parse (
|
|
7700
8077
|
}
|
7701
8078
|
|
7702
8079
|
function checkRootConstraints (el) {
|
7703
|
-
|
8080
|
+
{
|
7704
8081
|
if (el.tag === 'slot' || el.tag === 'template') {
|
7705
|
-
|
7706
|
-
warn$2(
|
8082
|
+
warnOnce(
|
7707
8083
|
"Cannot use <" + (el.tag) + "> as component root element because it may " +
|
7708
8084
|
'contain multiple nodes.'
|
7709
8085
|
);
|
7710
8086
|
}
|
7711
8087
|
if (el.attrsMap.hasOwnProperty('v-for')) {
|
7712
|
-
|
7713
|
-
warn$2(
|
8088
|
+
warnOnce(
|
7714
8089
|
'Cannot use v-for on stateful component root element because ' +
|
7715
8090
|
'it renders multiple elements.'
|
7716
8091
|
);
|
@@ -7730,9 +8105,8 @@ function parse (
|
|
7730
8105
|
exp: element.elseif,
|
7731
8106
|
block: element
|
7732
8107
|
});
|
7733
|
-
} else
|
7734
|
-
|
7735
|
-
warn$2(
|
8108
|
+
} else {
|
8109
|
+
warnOnce(
|
7736
8110
|
"Component template should contain exactly one root element. " +
|
7737
8111
|
"If you are using v-if on multiple elements, " +
|
7738
8112
|
"use v-else-if to chain them instead."
|
@@ -7777,11 +8151,16 @@ function parse (
|
|
7777
8151
|
|
7778
8152
|
chars: function chars (text) {
|
7779
8153
|
if (!currentParent) {
|
7780
|
-
|
7781
|
-
|
7782
|
-
|
7783
|
-
|
7784
|
-
|
8154
|
+
{
|
8155
|
+
if (text === template) {
|
8156
|
+
warnOnce(
|
8157
|
+
'Component template requires a root element, rather than just text.'
|
8158
|
+
);
|
8159
|
+
} else if ((text = text.trim())) {
|
8160
|
+
warnOnce(
|
8161
|
+
("text \"" + text + "\" outside root element will be ignored.")
|
8162
|
+
);
|
8163
|
+
}
|
7785
8164
|
}
|
7786
8165
|
return
|
7787
8166
|
}
|
@@ -7794,7 +8173,7 @@ function parse (
|
|
7794
8173
|
}
|
7795
8174
|
var children = currentParent.children;
|
7796
8175
|
text = inPre || text.trim()
|
7797
|
-
? decodeHTMLCached(text)
|
8176
|
+
? isTextTag(currentParent) ? text : decodeHTMLCached(text)
|
7798
8177
|
// only preserve whitespace if its not right after a starting tag
|
7799
8178
|
: preserveWhitespace && children.length ? ' ' : '';
|
7800
8179
|
if (text) {
|
@@ -7980,7 +8359,7 @@ function processComponent (el) {
|
|
7980
8359
|
|
7981
8360
|
function processAttrs (el) {
|
7982
8361
|
var list = el.attrsList;
|
7983
|
-
var i, l, name, rawName, value,
|
8362
|
+
var i, l, name, rawName, value, modifiers, isProp;
|
7984
8363
|
for (i = 0, l = list.length; i < l; i++) {
|
7985
8364
|
name = rawName = list[i].name;
|
7986
8365
|
value = list[i].value;
|
@@ -8005,6 +8384,13 @@ function processAttrs (el) {
|
|
8005
8384
|
if (modifiers.camel) {
|
8006
8385
|
name = camelize(name);
|
8007
8386
|
}
|
8387
|
+
if (modifiers.sync) {
|
8388
|
+
addHandler(
|
8389
|
+
el,
|
8390
|
+
("update:" + (camelize(name))),
|
8391
|
+
genAssignmentCode(value, "$event")
|
8392
|
+
);
|
8393
|
+
}
|
8008
8394
|
}
|
8009
8395
|
if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
8010
8396
|
addProp(el, name, value);
|
@@ -8013,12 +8399,13 @@ function processAttrs (el) {
|
|
8013
8399
|
}
|
8014
8400
|
} else if (onRE.test(name)) { // v-on
|
8015
8401
|
name = name.replace(onRE, '');
|
8016
|
-
addHandler(el, name, value, modifiers);
|
8402
|
+
addHandler(el, name, value, modifiers, false, warn$2);
|
8017
8403
|
} else { // normal directives
|
8018
8404
|
name = name.replace(dirRE, '');
|
8019
8405
|
// parse arg
|
8020
8406
|
var argMatch = name.match(argRE);
|
8021
|
-
|
8407
|
+
var arg = argMatch && argMatch[1];
|
8408
|
+
if (arg) {
|
8022
8409
|
name = name.slice(0, -(arg.length + 1));
|
8023
8410
|
}
|
8024
8411
|
addDirective(el, name, rawName, value, arg, modifiers);
|
@@ -8067,7 +8454,10 @@ function parseModifiers (name) {
|
|
8067
8454
|
function makeAttrsMap (attrs) {
|
8068
8455
|
var map = {};
|
8069
8456
|
for (var i = 0, l = attrs.length; i < l; i++) {
|
8070
|
-
if (
|
8457
|
+
if (
|
8458
|
+
"development" !== 'production' &&
|
8459
|
+
map[attrs[i].name] && !isIE && !isEdge
|
8460
|
+
) {
|
8071
8461
|
warn$2('duplicate attribute: ' + attrs[i].name);
|
8072
8462
|
}
|
8073
8463
|
map[attrs[i].name] = attrs[i].value;
|
@@ -8075,6 +8465,11 @@ function makeAttrsMap (attrs) {
|
|
8075
8465
|
return map
|
8076
8466
|
}
|
8077
8467
|
|
8468
|
+
// for script (e.g. type="x/template") or style, do not decode content
|
8469
|
+
function isTextTag (el) {
|
8470
|
+
return el.tag === 'script' || el.tag === 'style'
|
8471
|
+
}
|
8472
|
+
|
8078
8473
|
function isForbiddenTag (el) {
|
8079
8474
|
return (
|
8080
8475
|
el.tag === 'style' ||
|
@@ -8270,15 +8665,30 @@ var modifierCode = {
|
|
8270
8665
|
shift: genGuard("!$event.shiftKey"),
|
8271
8666
|
alt: genGuard("!$event.altKey"),
|
8272
8667
|
meta: genGuard("!$event.metaKey"),
|
8273
|
-
left: genGuard("$event.button !== 0"),
|
8274
|
-
middle: genGuard("$event.button !== 1"),
|
8275
|
-
right: genGuard("$event.button !== 2")
|
8668
|
+
left: genGuard("'button' in $event && $event.button !== 0"),
|
8669
|
+
middle: genGuard("'button' in $event && $event.button !== 1"),
|
8670
|
+
right: genGuard("'button' in $event && $event.button !== 2")
|
8276
8671
|
};
|
8277
8672
|
|
8278
|
-
function genHandlers (
|
8673
|
+
function genHandlers (
|
8674
|
+
events,
|
8675
|
+
native,
|
8676
|
+
warn
|
8677
|
+
) {
|
8279
8678
|
var res = native ? 'nativeOn:{' : 'on:{';
|
8280
8679
|
for (var name in events) {
|
8281
|
-
|
8680
|
+
var handler = events[name];
|
8681
|
+
// #5330: warn click.right, since right clicks do not actually fire click events.
|
8682
|
+
if ("development" !== 'production' &&
|
8683
|
+
name === 'click' &&
|
8684
|
+
handler && handler.modifiers && handler.modifiers.right
|
8685
|
+
) {
|
8686
|
+
warn(
|
8687
|
+
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
|
8688
|
+
"do not actually fire \"click\" events."
|
8689
|
+
);
|
8690
|
+
}
|
8691
|
+
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
|
8282
8692
|
}
|
8283
8693
|
return res.slice(0, -1) + '}'
|
8284
8694
|
}
|
@@ -8289,34 +8699,52 @@ function genHandler (
|
|
8289
8699
|
) {
|
8290
8700
|
if (!handler) {
|
8291
8701
|
return 'function(){}'
|
8292
|
-
}
|
8702
|
+
}
|
8703
|
+
|
8704
|
+
if (Array.isArray(handler)) {
|
8293
8705
|
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
8294
|
-
}
|
8295
|
-
|
8706
|
+
}
|
8707
|
+
|
8708
|
+
var isMethodPath = simplePathRE.test(handler.value);
|
8709
|
+
var isFunctionExpression = fnExpRE.test(handler.value);
|
8710
|
+
|
8711
|
+
if (!handler.modifiers) {
|
8712
|
+
return isMethodPath || isFunctionExpression
|
8296
8713
|
? handler.value
|
8297
|
-
: ("function($event){" + (handler.value) + "}")
|
8714
|
+
: ("function($event){" + (handler.value) + "}") // inline statement
|
8298
8715
|
} else {
|
8299
8716
|
var code = '';
|
8717
|
+
var genModifierCode = '';
|
8300
8718
|
var keys = [];
|
8301
8719
|
for (var key in handler.modifiers) {
|
8302
8720
|
if (modifierCode[key]) {
|
8303
|
-
|
8721
|
+
genModifierCode += modifierCode[key];
|
8722
|
+
// left/right
|
8723
|
+
if (keyCodes[key]) {
|
8724
|
+
keys.push(key);
|
8725
|
+
}
|
8304
8726
|
} else {
|
8305
8727
|
keys.push(key);
|
8306
8728
|
}
|
8307
8729
|
}
|
8308
8730
|
if (keys.length) {
|
8309
|
-
code
|
8731
|
+
code += genKeyFilter(keys);
|
8310
8732
|
}
|
8311
|
-
|
8733
|
+
// Make sure modifiers like prevent and stop get executed after key filtering
|
8734
|
+
if (genModifierCode) {
|
8735
|
+
code += genModifierCode;
|
8736
|
+
}
|
8737
|
+
var handlerCode = isMethodPath
|
8312
8738
|
? handler.value + '($event)'
|
8313
|
-
:
|
8739
|
+
: isFunctionExpression
|
8740
|
+
? ("(" + (handler.value) + ")($event)")
|
8741
|
+
: handler.value;
|
8314
8742
|
return ("function($event){" + code + handlerCode + "}")
|
8315
8743
|
}
|
8316
8744
|
}
|
8317
8745
|
|
8318
8746
|
function genKeyFilter (keys) {
|
8319
|
-
return ("if(" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
8747
|
+
return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
8320
8748
|
}
|
8321
8749
|
|
8322
8750
|
function genFilterCode (key) {
|
@@ -8534,10 +8962,10 @@ function genData (el) {
|
|
8534
8962
|
}
|
8535
8963
|
// event handlers
|
8536
8964
|
if (el.events) {
|
8537
|
-
data += (genHandlers(el.events)) + ",";
|
8965
|
+
data += (genHandlers(el.events, false, warn$3)) + ",";
|
8538
8966
|
}
|
8539
8967
|
if (el.nativeEvents) {
|
8540
|
-
data += (genHandlers(el.nativeEvents, true)) + ",";
|
8968
|
+
data += (genHandlers(el.nativeEvents, true, warn$3)) + ",";
|
8541
8969
|
}
|
8542
8970
|
// slot target
|
8543
8971
|
if (el.slotTarget) {
|
@@ -8549,7 +8977,7 @@ function genData (el) {
|
|
8549
8977
|
}
|
8550
8978
|
// component v-model
|
8551
8979
|
if (el.model) {
|
8552
|
-
data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + "},";
|
8980
|
+
data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
8553
8981
|
}
|
8554
8982
|
// inline-template
|
8555
8983
|
if (el.inlineTemplate) {
|
@@ -8626,10 +9054,8 @@ function genChildren (el, checkSkip) {
|
|
8626
9054
|
el$1.tag !== 'slot') {
|
8627
9055
|
return genElement(el$1)
|
8628
9056
|
}
|
8629
|
-
var normalizationType = getNormalizationType(children);
|
8630
|
-
return ("[" + (children.map(genNode).join(',')) + "]" + (
|
8631
|
-
? normalizationType ? ("," + normalizationType) : ''
|
8632
|
-
: ''))
|
9057
|
+
var normalizationType = checkSkip ? getNormalizationType(children) : 0;
|
9058
|
+
return ("[" + (children.map(genNode).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
|
8633
9059
|
}
|
8634
9060
|
}
|
8635
9061
|
|
@@ -8721,14 +9147,22 @@ function transformSpecialNewlines (text) {
|
|
8721
9147
|
|
8722
9148
|
/* */
|
8723
9149
|
|
8724
|
-
//
|
9150
|
+
// these keywords should not appear inside expressions, but operators like
|
9151
|
+
// typeof, instanceof and in are allowed
|
8725
9152
|
var prohibitedKeywordRE = new RegExp('\\b' + (
|
8726
9153
|
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
8727
9154
|
'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
8728
9155
|
'extends,finally,continue,debugger,function,arguments'
|
8729
9156
|
).split(',').join('\\b|\\b') + '\\b');
|
9157
|
+
|
9158
|
+
// these unary operators should not be used as property/method names
|
9159
|
+
var unaryOperatorsRE = new RegExp('\\b' + (
|
9160
|
+
'delete,typeof,void'
|
9161
|
+
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
9162
|
+
|
8730
9163
|
// check valid identifier for v-for
|
8731
9164
|
var identRE = /[A-Za-z_$][\w$]*/;
|
9165
|
+
|
8732
9166
|
// strip strings in expressions
|
8733
9167
|
var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
8734
9168
|
|
@@ -8749,6 +9183,8 @@ function checkNode (node, errors) {
|
|
8749
9183
|
if (value) {
|
8750
9184
|
if (name === 'v-for') {
|
8751
9185
|
checkFor(node, ("v-for=\"" + value + "\""), errors);
|
9186
|
+
} else if (onRE.test(name)) {
|
9187
|
+
checkEvent(value, (name + "=\"" + value + "\""), errors);
|
8752
9188
|
} else {
|
8753
9189
|
checkExpression(value, (name + "=\"" + value + "\""), errors);
|
8754
9190
|
}
|
@@ -8765,6 +9201,18 @@ function checkNode (node, errors) {
|
|
8765
9201
|
}
|
8766
9202
|
}
|
8767
9203
|
|
9204
|
+
function checkEvent (exp, text, errors) {
|
9205
|
+
var stipped = exp.replace(stripStringRE, '');
|
9206
|
+
var keywordMatch = stipped.match(unaryOperatorsRE);
|
9207
|
+
if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
9208
|
+
errors.push(
|
9209
|
+
"avoid using JavaScript unary operator as property name: " +
|
9210
|
+
"\"" + (keywordMatch[0]) + "\" in expression " + (text.trim())
|
9211
|
+
);
|
9212
|
+
}
|
9213
|
+
checkExpression(exp, text, errors);
|
9214
|
+
}
|
9215
|
+
|
8768
9216
|
function checkFor (node, text, errors) {
|
8769
9217
|
checkExpression(node.for || '', text, errors);
|
8770
9218
|
checkIdentifier(node.alias, 'v-for alias', text, errors);
|
@@ -9072,6 +9520,7 @@ var baseOptions = {
|
|
9072
9520
|
isPreTag: isPreTag,
|
9073
9521
|
isUnaryTag: isUnaryTag,
|
9074
9522
|
mustUseProp: mustUseProp,
|
9523
|
+
canBeLeftOpenTag: canBeLeftOpenTag,
|
9075
9524
|
isReservedTag: isReservedTag,
|
9076
9525
|
getTagNamespace: getTagNamespace,
|
9077
9526
|
staticKeys: genStaticKeys(modules$1)
|
@@ -9131,8 +9580,8 @@ Vue$3.prototype.$mount = function (
|
|
9131
9580
|
}
|
9132
9581
|
if (template) {
|
9133
9582
|
/* istanbul ignore if */
|
9134
|
-
if ("development" !== 'production' && config.performance &&
|
9135
|
-
|
9583
|
+
if ("development" !== 'production' && config.performance && mark) {
|
9584
|
+
mark('compile');
|
9136
9585
|
}
|
9137
9586
|
|
9138
9587
|
var ref = compileToFunctions(template, {
|
@@ -9145,9 +9594,9 @@ Vue$3.prototype.$mount = function (
|
|
9145
9594
|
options.staticRenderFns = staticRenderFns;
|
9146
9595
|
|
9147
9596
|
/* istanbul ignore if */
|
9148
|
-
if ("development" !== 'production' && config.performance &&
|
9149
|
-
|
9150
|
-
|
9597
|
+
if ("development" !== 'production' && config.performance && mark) {
|
9598
|
+
mark('compile end');
|
9599
|
+
measure(((this._name) + " compile"), 'compile', 'compile end');
|
9151
9600
|
}
|
9152
9601
|
}
|
9153
9602
|
}
|