提交 aa21ddf8 编写于 作者: fxy060608's avatar fxy060608

Merge branch 'dev' of https://github.com/dcloudio/uni-app into alpha

......@@ -25,7 +25,13 @@
<li class="show-sponsor-in-phone show-last"><a href="//ext.dcloud.net.cn/" target="__blank">插件市场</a></li>
<li class="show-sponsor-in-phone"><a href="//dev.dcloud.net.cn/wish/?channel=uniapp" target="__blank">需求墙</a></li>
<li class="show-sponsor-in-phone"><a href="//dev.dcloud.net.cn/sponsor/?channel=uniapp" target="__blank">赞助我们</a></li>
<div class="contact-box">
<div class="contact-box">
<a href="//unicloud.dcloud.net.cn" target="_blank" class="contact-item">
<img src="//img.cdn.aliyun.dcloud.net.cn/uni-app/cloud%402x.jpg" width="20" height="20"/>
<div class="contact-smg">
<div>uniCloud Web控制台</div>
</div>
</a>
<a href="//ask.dcloud.net.cn/explore/" target="_blank" class="contact-item">
<img src="//img-cdn-qiniu.dcloud.net.cn/uniapp/doc/d@2x.png" width="20" height="20"/>
<div class="contact-smg">
......
......@@ -133,7 +133,13 @@
* [广告](api/other/advertisement.md)
<li></li>
<div class="contact-box">
<div class="contact-box">
<a href="//unicloud.dcloud.net.cn" target="_blank" class="contact-item">
<img src="//img.cdn.aliyun.dcloud.net.cn/uni-app/cloud%402x.jpg" width="20" height="20"/>
<div class="contact-smg">
<div>uniCloud Web控制台</div>
</div>
</a>
<a href="//ask.dcloud.net.cn/explore/" target="_blank" class="contact-item">
<img src="//img-cdn-qiniu.dcloud.net.cn/uniapp/doc/d@2x.png" width="20" height="20"/>
<div class="contact-smg">
......
......@@ -13,7 +13,13 @@
* [页面](collocation/frame/window.md)
* [页面通讯](collocation/frame/communication.md)
<li></li>
<div class="contact-box">
<div class="contact-box">
<a href="//unicloud.dcloud.net.cn" target="_blank" class="contact-item">
<img src="//img.cdn.aliyun.dcloud.net.cn/uni-app/cloud%402x.jpg" width="20" height="20"/>
<div class="contact-smg">
<div>uniCloud Web控制台</div>
</div>
</a>
<a href="//ask.dcloud.net.cn/explore/" target="_blank" class="contact-item">
<img src="//img-cdn-qiniu.dcloud.net.cn/uniapp/doc/d@2x.png" width="20" height="20"/>
<div class="contact-smg">
......
......@@ -84,7 +84,13 @@
* [page-meta](component/page-meta.md)
* [配置小程序插件](component/mp-weixin-plugin.md)
* [原生组件说明](component/native-component.md)
<div class="contact-box">
<div class="contact-box">
<a href="//unicloud.dcloud.net.cn" target="_blank" class="contact-item">
<img src="//img.cdn.aliyun.dcloud.net.cn/uni-app/cloud%402x.jpg" width="20" height="20"/>
<div class="contact-smg">
<div>uniCloud Web控制台</div>
</div>
</a>
<a href="//ask.dcloud.net.cn/explore/" target="_blank" class="contact-item">
<img src="//img-cdn-qiniu.dcloud.net.cn/uniapp/doc/d@2x.png" width="20" height="20"/>
<div class="contact-smg">
......
......@@ -27,6 +27,12 @@
<li></li>
<div class="contact-box">
<a href="//unicloud.dcloud.net.cn" target="_blank" class="contact-item">
<img src="//img.cdn.aliyun.dcloud.net.cn/uni-app/cloud%402x.jpg" width="20" height="20"/>
<div class="contact-smg">
<div>uniCloud Web控制台</div>
</div>
</a>
<a href="//ask.dcloud.net.cn/explore/" target="_blank" class="contact-item">
<img src="//img-cdn-qiniu.dcloud.net.cn/uniapp/doc/d@2x.png" width="20" height="20"/>
<div class="contact-smg">
......
......@@ -13,4 +13,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function M(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var u=arguments[t],i=0,c=u.length;i<c;i++,o++)r[o]=u[i];return r}"undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);for(var A=[],D=0;D<256;++D)A[D]=(D+256).toString(16).substr(1);function N(e){var t=getCurrentPages().find((function(t){return t.$page.id===e}));if(!t)throw Error("page["+e+"] not found");var n=t.$vm._$weex;return n.document.__$weex__||(n.document.__$weex__=n),n.document}var k={},q={};["text","image","input","textarea","video","web-view","slider"].forEach((function(e){k[e]=!0,q["u-"+e]=!0}));var j=["movable-view","picker","ad","button","checkbox-group","checkbox","form","icon","label","movable-area","navigator","picker-view-column","picker-view","progress","radio-group","radio","rich-text","u-slider","swiper-item","swiper","switch"],R=j.map((function(e){return s(a(e))}));function V(e){var t=e.type;if(q[t])return t.replace("u-","");var n=e.__vue__&&e.__vue__.$options.name;return"USlider"===n?"slider":n&&-1!==R.indexOf(n)?i(n):t}function L(e){var t={elementId:e.nodeId,tagName:V(e),nvue:!0},n=e.__vue__;return n&&!n.$options.isReserved&&(t.nodeId=n._uid),"video"===t.tagName&&(t.videoId=t.nodeId),t}function B(e,t,n){for(var r=e.children,o=0;o<r.length;o++){var u=r[o];if(t(u)){if(!n)return u;n.push(u)}if(n)B(u,t,n);else{var i=B(u,t,n);if(i)return i}}return n}function H(e,t,n){var r,o;if(0===t.indexOf("#")?(r=t.substr(1),o=function(e){return e.attr&&e.attr.id===r}):0===t.indexOf(".")&&(r=t.substr(1),o=function(e){return e.classList&&-1!==e.classList.indexOf(r)}),o){var u=B(e,o,n);if(!u)throw Error("Node("+t+") not exists");return u}if("body"===t)return Object.assign({},e,{type:"page"});0===t.indexOf("uni-")&&(t=t.replace("uni-",""));var i=k[t]?"u-"+t:t,c=-1!==j.indexOf(i)?s(a(i)):"",f=B(e,(function(e){return e.type===i||c&&e.__vue__&&e.__vue__.$options.name===c}),n);if(!f)throw Error("Node("+t+") not exists");return f}var U=[{test:function(e){return 2===e.length&&-1!==e.indexOf("document.documentElement.scrollWidth")&&-1!==e.indexOf("document.documentElement.scrollHeight")},call:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e){return 1===e.length&&"document.documentElement.scrollTop"===e[0]},call:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){n([e.size&&Math.abs(e.size.top)||0])}))}))}},{test:function(e){return 2===e.length&&-1!==e.indexOf("offsetWidth")&&-1!==e.indexOf("offsetHeight")},call:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e,t){return 1===e.length&&"innerText"===e[0]},call:function(e){return Promise.resolve([X(e,[]).join("")])}}];function X(e,t){return"u-text"===e.type?t.push(e.attr.value):e.pureChildren.map((function(e){return X(e,t)})),t}function W(e){return e.replace(/\n/g,"").replace(/<u-/g,"<").replace(/<\/u-/g,"</")}function z(e,t){return"outer"===t?"body"===e.role&&"scroll-view"===e.type?"<page>"+W(z(e,"inner"))+"</page>":W(e.toString()):W(e.pureChildren.map((function(e){return e.toString()})).join(""))}var J={input:{input:function(e,t){e.setValue(t)}},textarea:{input:function(e,t){e.setValue(t)}},"scroll-view":{scrollTo:function(e,t,n){e.scrollTo(n)},scrollTop:function(e){return 0},scrollLeft:function(e){return 0},scrollWidth:function(e){return 0},scrollHeight:function(e){return 0}},swiper:{swipeTo:function(e,t){e.__vue__.current=t}},"movable-view":{moveTo:function(e,t,n){var r=e.__vue__;r.x=t,r.y=n}},switch:{tap:function(e){var t=e.__vue__;t.checked=!t.checked}},slider:{slideTo:function(e,t){e.__vue__.value=t}}};function F(e){return N(e).body}var K={getWindow:function(e){return F(e)},getDocument:function(e){return F(e)},getEl:function(e,t){var n=N(t).getRef(e);if(!n)throw Error("element destroyed");return n},getOffset:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n({left:e.size.left,top:e.size.top}):n({left:0,top:0})}))}))},querySelector:function(e,t){return Promise.resolve(L(H(e,t)))},querySelectorAll:function(e,t){return Promise.resolve({elements:H(e,t,[]).map((function(e){return L(e)}))})},queryProperties:function(e,t){var n=U.find((function(n){return n.test(t,e)}));return n?n.call(e).then((function(e){return{properties:e}})):Promise.resolve({properties:t.map((function(t){return d(e,t)}))})},queryAttributes:function(e,t){var n=e.attr;return Promise.resolve({attributes:t.map((function(t){return"class"===t?(e.classList||[]).join(" "):String(n[t]||n[a(t)]||"")}))})},queryStyles:function(e,t){var n=e.style;return Promise.resolve({styles:t.map((function(e){return n[e]}))})},queryHTML:function(e,t){return Promise.resolve({html:z(e,t)})},dispatchTapEvent:function(e){return e.fireEvent("click",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchLongpressEvent:function(e){return e.fireEvent("longpress",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchTouchEvent:function(e,t,n){return n||(n={}),n.touches||(n.touches=[]),n.changedTouches||(n.changedTouches=[]),n.touches.length||n.touches.push({identifier:Date.now(),target:e}),e.fireEvent(t,Object.assign({timeStamp:Date.now(),target:e,currentTarget:e},n),!0),Promise.resolve()},callFunction:function(e,t,n){var r=d(J,t);return r?Promise.resolve({result:r.apply(null,M([e],n))}):Promise.reject(Error(t+" not exists"))},triggerEvent:function(e,t,n){var r=e.__vue__;return r?r.$trigger&&r.$trigger(t,{},n):e.fireEvent(t,{timeStamp:Date.now(),target:e,currentTarget:e},!1,{params:[{detail:n}]}),Promise.resolve()}};var Q={};Object.keys($).forEach((function(e){Q["App."+e]=$[e]})),Object.keys(b).forEach((function(e){Q["Page."+e]=b[e]})),Object.keys(C).forEach((function(e){Q["Element."+e]=C[e]}));var Y,Z,G,ee=process.env.UNI_AUTOMATOR_WS_ENDPOINT;function te(e){G.send({data:JSON.stringify(e)})}function ne(e){var t=JSON.parse(e.data),n=t.id,r=t.method,o=t.params,u={id:n},i=Q[r];if(!i){if(Z){var c=Z(n,r,o,u);if(!0===c)return;i=c}if(!i)return u.error={message:r+" unimplemented"},te(u)}try{i(o).then((function(e){e&&(u.result=e)})).catch((function(e){u.error={message:e.message}})).finally((function(){te(u)}))}catch(e){u.error={message:e.message},te(u)}}Z=function(e,t,n,r){var o=n.pageId,u=function(e){var t=getCurrentPages();if(!e)return t[t.length-1];return t.find((function(t){return t.$page.id===e}))}(o);return u?!u.$page.meta.isNVue?(UniServiceJSBridge.publishHandler("sendAutoMessage",{id:e,method:t,params:n},o),!0):(Y||(Y=Object.assign({},function(e){return{"Page.getElement":function(t){return e.querySelector(e.getDocument(t.pageId),t.selector)},"Page.getElements":function(t){return e.querySelectorAll(e.getDocument(t.pageId),t.selector)},"Page.getWindowProperties":function(t){return e.queryProperties(e.getWindow(t.pageId),t.names)}}}(K),function(e){var t=function(t){return e.getEl(t.elementId,t.pageId)};return{"Element.getElement":function(n){return e.querySelector(t(n),n.selector)},"Element.getElements":function(n){return e.querySelectorAll(t(n),n.selector)},"Element.getDOMProperties":function(n){return e.queryProperties(t(n),n.names)},"Element.getProperties":function(n){var r=t(n),o=r.__vue__||r.attr||{};return e.queryProperties(o,n.names)},"Element.getOffset":function(n){return e.getOffset(t(n))},"Element.getAttributes":function(n){return e.queryAttributes(t(n),n.names)},"Element.getStyles":function(n){return e.queryStyles(t(n),n.names)},"Element.getHTML":function(n){return e.queryHTML(t(n),n.type)},"Element.tap":function(n){return e.dispatchTapEvent(t(n))},"Element.longpress":function(n){return e.dispatchLongpressEvent(t(n))},"Element.touchstart":function(n){return e.dispatchTouchEvent(t(n),"touchstart",n)},"Element.touchmove":function(n){return e.dispatchTouchEvent(t(n),"touchmove",n)},"Element.touchend":function(n){return e.dispatchTouchEvent(t(n),"touchend",n)},"Element.callFunction":function(n){return e.callFunction(t(n),n.functionName,n.args)},"Element.triggerEvent":function(n){return e.triggerEvent(t(n),n.type,n.detail)}}}(K))),Y[t]):(r.error={message:"page["+o+"] not exists"},te(r),!0)},UniServiceJSBridge.subscribe("onAutoMessageReceive",(function(e){te(e)})),setTimeout((function(){var e;global.testMessage=ne,void 0===e&&(e={}),(G=uni.connectSocket({url:ee,complete:function(){}})).onMessage(ne),G.onOpen((function(t){e.success&&e.success(),console.log("已开启自动化测试...")})),G.onError((function(e){console.log("automator.onError",e)})),G.onClose((function(){e.fail&&e.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))}),500);
function M(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var u=arguments[t],i=0,c=u.length;i<c;i++,o++)r[o]=u[i];return r}"undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);for(var A=[],D=0;D<256;++D)A[D]=(D+256).toString(16).substr(1);function N(e){var t=getCurrentPages().find((function(t){return t.$page.id===e}));if(!t)throw Error("page["+e+"] not found");var n=t.$vm._$weex;return n.document.__$weex__||(n.document.__$weex__=n),n.document}var k={},q={};["text","image","input","textarea","video","web-view","slider"].forEach((function(e){k[e]=!0,q["u-"+e]=!0}));var j=["movable-view","picker","ad","button","checkbox-group","checkbox","form","icon","label","movable-area","navigator","picker-view-column","picker-view","progress","radio-group","radio","rich-text","u-slider","swiper-item","swiper","switch"],R=j.map((function(e){return s(a(e))}));function V(e){var t=e.type;if(q[t])return t.replace("u-","");var n=e.__vue__&&e.__vue__.$options.name;return"USlider"===n?"slider":n&&-1!==R.indexOf(n)?i(n):t}function L(e){var t={elementId:e.nodeId,tagName:V(e),nvue:!0},n=e.__vue__;return n&&!n.$options.isReserved&&(t.nodeId=n._uid),"video"===t.tagName&&(t.videoId=t.nodeId),t}function B(e,t,n){for(var r=e.children,o=0;o<r.length;o++){var u=r[o];if(t(u)){if(!n)return u;n.push(u)}if(n)B(u,t,n);else{var i=B(u,t,n);if(i)return i}}return n}function H(e,t,n){var r,o;if(0===t.indexOf("#")?(r=t.substr(1),o=function(e){return e.attr&&e.attr.id===r}):0===t.indexOf(".")&&(r=t.substr(1),o=function(e){return e.classList&&-1!==e.classList.indexOf(r)}),o){var u=B(e,o,n);if(!u)throw Error("Node("+t+") not exists");return u}if("body"===t)return Object.assign({},e,{type:"page"});0===t.indexOf("uni-")&&(t=t.replace("uni-",""));var i=k[t]?"u-"+t:t,c=-1!==j.indexOf(i)?s(a(i)):"",f=B(e,(function(e){return e.type===i||c&&e.__vue__&&e.__vue__.$options.name===c}),n);if(!f)throw Error("Node("+t+") not exists");return f}var U=[{test:function(e){return 2===e.length&&-1!==e.indexOf("document.documentElement.scrollWidth")&&-1!==e.indexOf("document.documentElement.scrollHeight")},call:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e){return 1===e.length&&"document.documentElement.scrollTop"===e[0]},call:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){"scroll-view"===e.type&&1===e.children.length&&(e=e.children[0]),t.requireModule("dom").getComponentRect(e.ref,(function(e){n([e.size&&Math.abs(e.size.top)||0])}))}))}},{test:function(e){return 2===e.length&&-1!==e.indexOf("offsetWidth")&&-1!==e.indexOf("offsetHeight")},call:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n([e.size.width,e.size.height]):n([0,0])}))}))}},{test:function(e,t){return 1===e.length&&"innerText"===e[0]},call:function(e){return Promise.resolve([X(e,[]).join("")])}}];function X(e,t){return"u-text"===e.type?t.push(e.attr.value):e.pureChildren.map((function(e){return X(e,t)})),t}function W(e){return e.replace(/\n/g,"").replace(/<u-/g,"<").replace(/<\/u-/g,"</")}function z(e,t){return"outer"===t?"body"===e.role&&"scroll-view"===e.type?"<page>"+W(z(e,"inner"))+"</page>":W(e.toString()):W(e.pureChildren.map((function(e){return e.toString()})).join(""))}var J={input:{input:function(e,t){e.setValue(t)}},textarea:{input:function(e,t){e.setValue(t)}},"scroll-view":{scrollTo:function(e,t,n){e.scrollTo(n)},scrollTop:function(e){return 0},scrollLeft:function(e){return 0},scrollWidth:function(e){return 0},scrollHeight:function(e){return 0}},swiper:{swipeTo:function(e,t){e.__vue__.current=t}},"movable-view":{moveTo:function(e,t,n){var r=e.__vue__;r.x=t,r.y=n}},switch:{tap:function(e){var t=e.__vue__;t.checked=!t.checked}},slider:{slideTo:function(e,t){e.__vue__.value=t}}};function F(e){return N(e).body}var K={getWindow:function(e){return F(e)},getDocument:function(e){return F(e)},getEl:function(e,t){var n=N(t).getRef(e);if(!n)throw Error("element destroyed");return n},getOffset:function(e){var t=e.__$weex__||e.ownerDocument.__$weex__;return new Promise((function(n){t.requireModule("dom").getComponentRect(e.ref,(function(e){e.result?n({left:e.size.left,top:e.size.top}):n({left:0,top:0})}))}))},querySelector:function(e,t){return Promise.resolve(L(H(e,t)))},querySelectorAll:function(e,t){return Promise.resolve({elements:H(e,t,[]).map((function(e){return L(e)}))})},queryProperties:function(e,t){var n=U.find((function(n){return n.test(t,e)}));return n?n.call(e).then((function(e){return{properties:e}})):Promise.resolve({properties:t.map((function(t){return d(e,t)}))})},queryAttributes:function(e,t){var n=e.attr;return Promise.resolve({attributes:t.map((function(t){return"class"===t?(e.classList||[]).join(" "):String(n[t]||n[a(t)]||"")}))})},queryStyles:function(e,t){var n=e.style;return Promise.resolve({styles:t.map((function(e){return n[e]}))})},queryHTML:function(e,t){return Promise.resolve({html:z(e,t)})},dispatchTapEvent:function(e){return e.fireEvent("click",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchLongpressEvent:function(e){return e.fireEvent("longpress",{timeStamp:Date.now(),target:e,currentTarget:e},!0),Promise.resolve()},dispatchTouchEvent:function(e,t,n){return n||(n={}),n.touches||(n.touches=[]),n.changedTouches||(n.changedTouches=[]),n.touches.length||n.touches.push({identifier:Date.now(),target:e}),e.fireEvent(t,Object.assign({timeStamp:Date.now(),target:e,currentTarget:e},n),!0),Promise.resolve()},callFunction:function(e,t,n){var r=d(J,t);return r?Promise.resolve({result:r.apply(null,M([e],n))}):Promise.reject(Error(t+" not exists"))},triggerEvent:function(e,t,n){var r=e.__vue__;return r?r.$trigger&&r.$trigger(t,{},n):e.fireEvent(t,{timeStamp:Date.now(),target:e,currentTarget:e},!1,{params:[{detail:n}]}),Promise.resolve()}};var Q={};Object.keys($).forEach((function(e){Q["App."+e]=$[e]})),Object.keys(b).forEach((function(e){Q["Page."+e]=b[e]})),Object.keys(C).forEach((function(e){Q["Element."+e]=C[e]}));var Y,Z,G,ee=process.env.UNI_AUTOMATOR_WS_ENDPOINT;function te(e){G.send({data:JSON.stringify(e)})}function ne(e){var t=JSON.parse(e.data),n=t.id,r=t.method,o=t.params,u={id:n},i=Q[r];if(!i){if(Z){var c=Z(n,r,o,u);if(!0===c)return;i=c}if(!i)return u.error={message:r+" unimplemented"},te(u)}try{i(o).then((function(e){e&&(u.result=e)})).catch((function(e){u.error={message:e.message}})).finally((function(){te(u)}))}catch(e){u.error={message:e.message},te(u)}}Z=function(e,t,n,r){var o=n.pageId,u=function(e){var t=getCurrentPages();if(!e)return t[t.length-1];return t.find((function(t){return t.$page.id===e}))}(o);return u?!u.$page.meta.isNVue?(UniServiceJSBridge.publishHandler("sendAutoMessage",{id:e,method:t,params:n},o),!0):(Y||(Y=Object.assign({},function(e){return{"Page.getElement":function(t){return e.querySelector(e.getDocument(t.pageId),t.selector)},"Page.getElements":function(t){return e.querySelectorAll(e.getDocument(t.pageId),t.selector)},"Page.getWindowProperties":function(t){return e.queryProperties(e.getWindow(t.pageId),t.names)}}}(K),function(e){var t=function(t){return e.getEl(t.elementId,t.pageId)};return{"Element.getElement":function(n){return e.querySelector(t(n),n.selector)},"Element.getElements":function(n){return e.querySelectorAll(t(n),n.selector)},"Element.getDOMProperties":function(n){return e.queryProperties(t(n),n.names)},"Element.getProperties":function(n){var r=t(n),o=r.__vue__||r.attr||{};return e.queryProperties(o,n.names)},"Element.getOffset":function(n){return e.getOffset(t(n))},"Element.getAttributes":function(n){return e.queryAttributes(t(n),n.names)},"Element.getStyles":function(n){return e.queryStyles(t(n),n.names)},"Element.getHTML":function(n){return e.queryHTML(t(n),n.type)},"Element.tap":function(n){return e.dispatchTapEvent(t(n))},"Element.longpress":function(n){return e.dispatchLongpressEvent(t(n))},"Element.touchstart":function(n){return e.dispatchTouchEvent(t(n),"touchstart",n)},"Element.touchmove":function(n){return e.dispatchTouchEvent(t(n),"touchmove",n)},"Element.touchend":function(n){return e.dispatchTouchEvent(t(n),"touchend",n)},"Element.callFunction":function(n){return e.callFunction(t(n),n.functionName,n.args)},"Element.triggerEvent":function(n){return e.triggerEvent(t(n),n.type,n.detail)}}}(K))),Y[t]):(r.error={message:"page["+o+"] not exists"},te(r),!0)},UniServiceJSBridge.subscribe("onAutoMessageReceive",(function(e){te(e)})),setTimeout((function(){var e;void 0===e&&(e={}),(G=uni.connectSocket({url:ee,complete:function(){}})).onMessage(ne),G.onOpen((function(t){e.success&&e.success(),console.log("已开启自动化测试...")})),G.onError((function(e){console.log("automator.onError",e)})),G.onClose((function(){e.fail&&e.fail({errMsg:"$$initRuntimeAutomator:fail"}),console.log("automator.onClose")}))}),500);
......@@ -12139,32 +12139,32 @@ var serviceContext = (function () {
this.id = uploadTaskId;
this._callbackId = callbackId;
this._callbacks = [];
}
}
abort () {
invokeMethod('operateRequestTask', {
invokeMethod('operateUploadTask', {
uploadTaskId: this.id,
operationType: 'abort'
});
}
}
onProgressUpdate (callback) {
if (typeof callback !== 'function') {
return
}
this._callbacks.push(callback);
}
}
onHeadersReceived () {
}
}
offProgressUpdate (callback) {
const index = this._callbacks.indexOf(callback);
if (index >= 0) {
this._callbacks.splice(index, 1);
}
}
}
offHeadersReceived () {
......@@ -12206,7 +12206,7 @@ var serviceContext = (function () {
errMsg: 'request:fail ' + errMsg
});
// eslint-disable-next-line no-fallthrough
default:
default:
// progressUpdate 可能晚于 success
setTimeout(() => {
delete uploadTasks$1[uploadTaskId];
......@@ -14208,6 +14208,20 @@ var serviceContext = (function () {
Vue.prototype.$mount = function mount (el, hydrating) {
if (this.mpType === 'app') {
this.$options.render = function () {};
if (weex.config.preload) { // preload
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] preload app-service.js');
}
const globalEvent = weex.requireModule('globalEvent');
globalEvent.addEventListener('launchApp', () => {
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] launchApp');
}
registerApp(this);
oldMount.call(this, el, hydrating);
});
return
}
registerApp(this);
}
return oldMount.call(this, el, hydrating)
......
......@@ -35,7 +35,8 @@ module.exports = {
}
process.env.UNI_PLATFORM = scriptOptions.env.UNI_PLATFORM
process.env.UNI_SCRIPT = name
process.UNI_SCRIPT_ENV = scriptOptions.env || {}
process.UNI_SCRIPT_DEFINE = scriptOptions.define || {}
......
此差异已折叠。
......@@ -2,7 +2,7 @@ const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
const VueLoaderPlugin = require('@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib/plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const {
......@@ -81,7 +81,8 @@ const plugins = [
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
VUE_APP_PLATFORM: JSON.stringify(process.env.UNI_PLATFORM),
UNI_CLOUD_PROVIDER: process.env.UNI_CLOUD_PROVIDER,
HBX_USER_TOKEN: JSON.stringify(process.env.HBX_USER_TOKEN || '')
HBX_USER_TOKEN: JSON.stringify(process.env.HBX_USER_TOKEN || ''),
UNI_AUTOMATOR_WS_ENDPOINT: JSON.stringify(process.env.UNI_AUTOMATOR_WS_ENDPOINT)
}
}),
new webpack.BannerPlugin({
......@@ -178,6 +179,26 @@ rules.unshift({
loader: '@dcloudio/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/template.recycle'
}]
})
if (process.env.UNI_USING_V3_NATIVE) {
try {
const automatorJson = require.resolve('@dcloudio/uni-automator/dist/automator.json')
plugins.push(new CopyWebpackPlugin([{
from: automatorJson,
to: '../.automator/' + (process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM) +
'/.automator.json',
transform (content) {
if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
return JSON.stringify({
version: require('@dcloudio/uni-automator/package.json').version,
wsEndpoint: process.env.UNI_AUTOMATOR_WS_ENDPOINT
})
}
return ''
}
}]))
} catch (e) {}
}
if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
plugins.push(new WebpackUniMPPlugin())
......
......@@ -4,7 +4,11 @@ const {
class WebpackAppPlusNVuePlugin {
apply (compiler) {
let isFirst = !process.env.UNI_USING_NATIVE && !process.env.UNI_USING_V3_NATIVE
let isFirst = !process.env.UNI_USING_NATIVE && !process.env.UNI_USING_V3_NATIVE
if (process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
isFirst = true
}
const chunkVersions = {}
const changedFiles = []
......
......@@ -70,5 +70,7 @@ module.exports = function (content, map) {
}
}
}
return statCode + content
const automatorCode = process.env.UNI_AUTOMATOR_WS_ENDPOINT ? 'import \'@dcloudio/uni-app-plus/dist/automator\';'
: ''
return automatorCode + statCode + content
}
......@@ -47,6 +47,20 @@ export default {
Vue.prototype.$mount = function mount (el, hydrating) {
if (this.mpType === 'app') {
this.$options.render = function () {}
if (weex.config.preload) { // preload
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] preload app-service.js')
}
const globalEvent = weex.requireModule('globalEvent')
globalEvent.addEventListener('launchApp', () => {
if (process.env.NODE_ENV !== 'production') {
console.log('[uni-app] launchApp')
}
registerApp(this)
oldMount.call(this, el, hydrating)
})
return
}
registerApp(this)
}
return oldMount.call(this, el, hydrating)
......@@ -70,4 +84,4 @@ export default {
return callback ? undefined : result
}
}
}
}
......@@ -3,9 +3,9 @@
<system-header
:confirm="!!data"
@back="_back"
@confirm="_choose"
>
选择位置
@confirm="_choose"
>
选择位置
</system-header>
<div class="map-content">
<iframe
......@@ -13,7 +13,7 @@
allow="geolocation"
seamless
sandbox="allow-scripts allow-same-origin allow-forms"
frameborder="0"
frameborder="0"
/>
</div>
</div>
......@@ -27,15 +27,14 @@ export default {
SystemHeader
},
data () {
const key = __uniConfig.qqMapKey
return {
src: '',
src: `https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=${key}&referer=uniapp`,
data: null
}
},
mounted () {
var key = __uniConfig.qqMapKey
this.src = `https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=${key}&referer=uniapp`
window.addEventListener('message', (event) => {
function handler (event) {
var loc = event.data
if (loc && loc.module === 'locationPicker') {
this.data = {
......@@ -45,12 +44,17 @@ export default {
longitude: loc.latlng.lng
}
}
}, false)
}
this.__messageHandle = handler.bind(this)
window.addEventListener('message', this.__messageHandle, false)
},
beforeDestroy () {
window.removeEventListener('message', this.__messageHandle, false)
},
methods: {
_choose () {
if (this.data) {
UniViewJSBridge.publishHandler('onChooseLocation', this.data)
UniViewJSBridge.publishHandler('onChooseLocation', Object.assign({}, this.data))
getApp().$router.back()
}
},
......
<template>
<div class="uni-system-open-location">
<system-header @back="_back">
位置
<system-header @back="_back">
位置
</system-header>
<div class="map-content">
<iframe
......@@ -10,13 +10,13 @@
allow="geolocation"
sandbox="allow-scripts allow-same-origin allow-forms allow-top-navigation allow-modals allow-popups"
frameborder="0"
@load="_load"
@load="_load"
/>
<!-- 去这里 -->
<div
v-if="isPoimarkerSrc"
class="actTonav"
@click="_nav"
@click="_nav"
/>
</div>
</div>
......@@ -47,16 +47,10 @@ export default {
scale,
name,
address,
src: '',
src: latitude && longitude ? `${poimarkerSrc}?type=0&marker=coord:${latitude},${longitude};title:${name};addr:${address};&key=${key}&referer=${referer}` : '',
isPoimarkerSrc: false
}
},
mounted () {
if (this.latitude && this.longitude) {
this.src =
`${poimarkerSrc}?type=0&marker=coord:${this.latitude},${this.longitude};title:${this.name};addr:${this.address};&key=${key}&referer=${referer}`
}
},
methods: {
_back () {
if (this.$refs.map.src.indexOf(poimarkerSrc) !== 0) {
......@@ -73,7 +67,7 @@ export default {
}
},
_nav () {
var url =
var url =
`https://map.qq.com/nav/drive#routes/page?transport=2&epointy=${this.latitude}&epointx=${this.longitude}&eword=${encodeURIComponent(this.name || '目的地')}&referer=${referer}`
this.$refs.map.src = url
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册