You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jiaojiu/dist/js/chunk-2ecb4718.89d81ee7.js.map

1 line
28 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{"version":3,"sources":["webpack:///./node_modules/core-js/modules/es.string.trim.js","webpack:///./src/views/detail/childComps/DetailChat.vue?aac1","webpack:///src/views/detail/childComps/DetailChat.vue","webpack:///./src/views/detail/childComps/DetailChat.vue?508c","webpack:///./src/views/detail/childComps/DetailChat.vue","webpack:///./src/assets/img/home/back.svg","webpack:///./src/views/detail/childComps/DetailChat.vue?42c8","webpack:///./src/components/common/Scroll/Scroll.vue?4111","webpack:///src/components/common/Scroll/Scroll.vue","webpack:///./src/components/common/Scroll/Scroll.vue?b835","webpack:///./src/components/common/Scroll/Scroll.vue","webpack:///./node_modules/core-js/modules/es.function.name.js","webpack:///./node_modules/core-js/internals/string-trim-forced.js"],"names":["$","$trim","trim","forcedStringTrimMethod","target","proto","forced","this","render","_vm","_h","$createElement","_c","_self","attrs","staticClass","on","backClick","slot","_v","_s","num","ref","loadMore","pullingDown","_l","item","index","key","size","name","getAvatar","uid","formdata","date","message","directives","rawName","value","expression","domProps","$event","forbidMove","composing","send","staticRenderFns","components","NavBar","Scroll","data","content","lists","ws","isshow","isme","roomid","handle","token","updated","created","window","localStorage","getItem","$router","push","methods","document","querySelector","scrollIntoView","$moment","fromNow","close","back","$refs","scroll","refresh","pullingdown","setTimeout","init","WebSocket","onopen","onOpen","onmessage","onMessage","onclose","onClose","onerror","onError","enter","isShow","obj","JSON","parse","event","$nextTick","_this","minemsg","Date","checkServer","clearTimeout","mounted","othis","component","module","exports","_t","props","probeType","type","Number","default","pullUpLoad","Boolean","pullDownLoad","click","threshold","stop","useTransition","pullDownRefresh","disableMouse","disableTouch","scrollTo","x","y","timer","finishPullUp","finishPullDown","getScrollY","DESCRIPTORS","defineProperty","f","FunctionPrototype","Function","prototype","FunctionPrototypeToString","toString","nameRE","NAME","configurable","get","call","match","error","fails","whitespaces","non","METHOD_NAME"],"mappings":"kHACA,IAAIA,EAAI,EAAQ,QACZC,EAAQ,EAAQ,QAA4BC,KAC5CC,EAAyB,EAAQ,QAIrCH,EAAE,CAAEI,OAAQ,SAAUC,OAAO,EAAMC,OAAQH,EAAuB,SAAW,CAC3ED,KAAM,WACJ,OAAOD,EAAMM,U,oECTjB,IAAIC,EAAS,WAAa,IAAIC,EAAIF,KAASG,EAAGD,EAAIE,eAAmBC,EAAGH,EAAII,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACE,MAAM,CAAC,GAAK,SAAS,CAACF,EAAG,SAAS,CAACG,YAAY,WAAW,CAACH,EAAG,MAAM,CAACG,YAAY,OAAOD,MAAM,CAAC,KAAO,QAAQE,GAAG,CAAC,MAAQP,EAAIQ,WAAWC,KAAK,QAAQ,CAACN,EAAG,MAAM,CAACE,MAAM,CAAC,IAAM,EAAQ,QAA8B,IAAM,QAAQF,EAAG,MAAM,CAACG,YAAY,QAAQD,MAAM,CAAC,KAAO,UAAUI,KAAK,UAAU,CAACT,EAAIU,GAAG,QAAQV,EAAIW,GAAGX,EAAIY,KAAK,SAAST,EAAG,SAAS,CAACU,IAAI,SAASP,YAAY,UAAUD,MAAM,CAAC,aAAa,EAAE,gBAAe,GAAME,GAAG,CAAC,UAAYP,EAAIc,SAAS,YAAcd,EAAIe,cAAc,CAACZ,EAAG,KAAKH,EAAIgB,GAAIhB,EAAS,OAAE,SAASiB,EAAKC,GAAO,OAAOf,EAAG,KAAK,CAACgB,IAAI,UAAYD,GAAO,CAAe,GAAbD,EAAKG,KAAWjB,EAAG,MAAM,CAACG,YAAY,aAAa,CAACN,EAAIU,GAAG,IAAIV,EAAIW,GAAGM,EAAKI,MAAM,WAAyB,GAAbJ,EAAKG,KAAWjB,EAAG,MAAM,CAACG,YAAY,aAAa,CAACN,EAAIU,G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AGC,EAAGC,IAE5CC,aAJJ,WAKMtH,KAAKoE,UACLpE,KAAKmE,QAAUnE,KAAKmE,OAAOmD,gBAE7BC,eARJ,WASMvH,KAAKoE,UACLpE,KAAKmE,QAAUnE,KAAKmE,OAAOoD,kBAG7BnD,QAbJ,WAcMpE,KAAKmE,QAAUnE,KAAKmE,OAAOC,WAE7BoD,WAhBJ,WAiBM,OAAOxH,KAAKmE,OAASnE,KAAKmE,OAAOiD,EAAI,KCjFmU,I,YCO1WrB,EAAY,eACd,EACA9F,EACAqC,GACA,EACA,KACA,WACA,MAIa,OAAAyD,E,8BClBf,IAAI0B,EAAc,EAAQ,QACtBC,EAAiB,EAAQ,QAAuCC,EAEhEC,EAAoBC,SAASC,UAC7BC,EAA4BH,EAAkBI,SAC9CC,EAAS,wBACTC,EAAO,OAIPT,KAAiBS,KAAQN,IAC3BF,EAAeE,EAAmBM,EAAM,CACtCC,cAAc,EACdC,IAAK,WACH,IACE,OAAOL,EAA0BM,KAAKrI,MAAMsI,MAAML,GAAQ,GAC1D,MAAOM,GACP,MAAO,Q,qBCjBf,IAAIC,EAAQ,EAAQ,QAChBC,EAAc,EAAQ,QAEtBC,EAAM,MAIV1C,EAAOC,QAAU,SAAU0C,GACzB,OAAOH,GAAM,WACX,QAASC,EAAYE,MAAkBD,EAAIC,MAAkBD,GAAOD,EAAYE,GAAapH,OAASoH","file":"js/chunk-2ecb4718.89d81ee7.js","sourcesContent":["'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.github.io/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{attrs:{\"id\":\"chat\"}},[_c('NavBar',{staticClass:\"nav-bar\"},[_c('div',{staticClass:\"back\",attrs:{\"slot\":\"left\"},on:{\"click\":_vm.backClick},slot:\"left\"},[_c('img',{attrs:{\"src\":require(\"@/assets/img/home/back.svg\"),\"alt\":\"\"}})]),_c('div',{staticClass:\"title\",attrs:{\"slot\":\"center\"},slot:\"center\"},[_vm._v(\"在线聊天(\"+_vm._s(_vm.num)+\")\")])]),_c('Scroll',{ref:\"scroll\",staticClass:\"content\",attrs:{\"probe-type\":3,\"pull-up-load\":true},on:{\"pullingUp\":_vm.loadMore,\"pullingDown\":_vm.pullingDown}},[_c('ul',_vm._l((_vm.lists),function(item,index){return _c('li',{key:'message' + index},[(item.size == 0)?_c('div',{staticClass:\"minienter\"},[_vm._v(\" \"+_vm._s(item.name)+\"进入群聊 \")]):(item.size == 3)?_c('div',{staticClass:\"minienter\"},[_vm._v(\" \"+_vm._s(item.name)+\"退出群聊 \")]):(item.size == 1)?_c('div',{staticClass:\"minemsg\"},[_c('div',[_c('img',{attrs:{\"src\":_vm.getAvatar(item.uid),\"alt\":\"\"}})]),_c('div',{staticClass:\"mine-bottom\"},[_c('div',{staticClass:\"namefont\"},[_vm._v(\" \"+_vm._s(item.name)+\" \"),_c('span',[_vm._v(_vm._s(_vm.formdata(item.date))+\" \")])]),_c('div',{staticClass:\"msg\"},[_vm._v(_vm._s(item.message))])])]):_c('div',{staticClass:\"othermsg\"},[_c('div',[_c('img',{attrs:{\"src\":_vm.getAvatar(item.uid),\"alt\":\"\"}})]),_c('div',{staticClass:\"mine-bottom\"},[_c('div',{staticClass:\"namefont\"},[_vm._v(\" \"+_vm._s(item.name)+\" \"),_c('span',[_vm._v(_vm._s(_vm.formdata(item.date))+\" \")])]),_c('div',{staticClass:\"msg\"},[_vm._v(_vm._s(item.message))])])])])}),0)]),_c('div',{staticClass:\"showcomment\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.message),expression:\"message\"}],attrs:{\"type\":\"text\",\"maxlength\":\"20\",\"id\":\"inputInfo\"},domProps:{\"value\":(_vm.message)},on:{\"blur\":function($event){return _vm.forbidMove()},\"input\":function($event){if($event.target.composing){ return; }_vm.message=$event.target.value}}}),_c('span',{on:{\"click\":function($event){return _vm.send()}}},[_vm._v(\"发送\")])])],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n <div id=\"chat\">\n <NavBar class=\"nav-bar\">\n <div slot=\"left\" class=\"back\" @click=\"backClick\">\n <img src=\"@/assets/img/home/back.svg\" alt=\"\" />\n </div>\n <div slot=\"center\" class=\"title\">在线聊天({{ num }})</div>\n </NavBar>\n <Scroll\n class=\"content\"\n ref=\"scroll\"\n :probe-type=\"3\"\n :pull-up-load=\"true\"\n @pullingUp=\"loadMore\"\n @pullingDown=\"pullingDown\"\n >\n <ul>\n <li v-for=\"(item, index) in lists\" :key=\"'message' + index\">\n <div v-if=\"item.size == 0\" class=\"minienter\">\n {{ item.name }}进入群聊\n </div>\n <div v-else-if=\"item.size == 3\" class=\"minienter\">\n {{ item.name }}退出群聊\n </div>\n <div v-else-if=\"item.size == 1\" class=\"minemsg\">\n <div><img :src=\"getAvatar(item.uid)\" alt=\"\" /></div>\n <div class=\"mine-bottom\">\n <div class=\"namefont\">\n {{ item.name }} <span>{{ formdata(item.date) }} </span>\n </div>\n <div class=\"msg\">{{ item.message }}</div>\n </div>\n </div>\n <div v-else class=\"othermsg\">\n <div><img :src=\"getAvatar(item.uid)\" alt=\"\" /></div>\n <div class=\"mine-bottom\">\n <div class=\"namefont\">\n {{ item.name }} <span>{{ formdata(item.date) }} </span>\n </div>\n <div class=\"msg\">{{ item.message }}</div>\n </div>\n </div>\n </li>\n </ul>\n </Scroll>\n <div class=\"showcomment\">\n <input type=\"text\" maxlength=\"20\" id=\"inputInfo\" v-model=\"message\" @blur=\"forbidMove()\" />\n <span @click=\"send()\">发送</span>\n </div>\n </div>\n</template>\n\n<script>\nimport NavBar from \"@/components/common/navbar/NavBar\";\nimport Scroll from \"@/components/common/Scroll/Scroll.vue\";\n\nexport default {\n name: \"DetailChat\",\n components: {\n NavBar,\n Scroll\n },\n data() {\n return {\n content: \"\",\n message: \"\",\n lists: [],\n ws: {},\n name: \"\",\n num: 0,\n isshow: true,\n isme: false,\n roomid: 1,\n uid: \"\",\n handle: {},\n token: \"\"\n };\n },\n updated() {},\n created() {\n this.token = window.localStorage.getItem(\"token\");\n if (!this.token) {\n this.$router.push(\"/login\");\n }\n },\n methods: {\n forbidMove() {\n document.querySelector(\"#inputInfo\").scrollIntoView(false);\n },\n formdata(date) {\n return this.$moment(date).fromNow();\n },\n getAvatar(uid) {\n return \"http://47.108.153.30:8001/users/\" + uid + \"/avatar\";\n },\n backClick() {\n this.ws.close();\n this.$router.back();\n },\n loadMore() {\n this.$refs.scroll.refresh();\n },\n pullingDown() {\n this.pullingdown = true;\n setTimeout(() => {\n this.pullingdown = false;\n this.$refs.scroll.finishPullDown();\n }, 300);\n },\n init() {\n this.ws = new WebSocket(\"ws://47.108.153.30:8002/\");\n this.ws.onopen = this.onOpen;\n this.ws.onmessage = this.onMessage;\n this.ws.onclose = this.onClose;\n this.ws.onerror = this.onError;\n },\n enter() {\n if (this.name.trim() === \"\") {\n this.$router.push(\"/login\");\n }\n this.init();\n this.isShow = false;\n },\n onOpen: function() {\n // console.log('open:' + this.ws.readyState);\n //ws.send('Hello fro,m client!')\n // 发起鉴权请求\n //this.ws.send(JSON.stringify({\n // event: 'auth',\n // message: //'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIx//MjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNT//E2MjM5MDIyfQ.//XbPfbIHMI6arZ3Y922BhjWgQzWXcXNrz0ogtVhfEd2o'\n //}))\n this.ws.send(\n JSON.stringify({\n event: \"enter\",\n message: this.name,\n roomid: this.roomid,\n uid: this.uid,\n date: new Date()\n })\n );\n },\n onMessage: function(event) {\n // 当用户未进入聊天室,则不接收消息\n if (this.isShow) {\n return;\n }\n // 接收服务端发送过来的消息\n var obj = JSON.parse(event.data);\n switch (obj.event) {\n case \"enter\":\n // 当有一个新的用户进入聊天室\n obj.size = 0;\n this.lists.push(obj);\n break;\n case \"out\":\n obj.size = 3;\n this.lists.push(obj);\n break;\n case \"heartbeat\":\n // this.checkServer(); // timeInterval + t\n // 可以注释掉以下心跳状态,主动测试服务端是否会断开客户端的连接\n this.ws.send(\n JSON.stringify({\n event: \"heartbeat\",\n message: \"pong\"\n })\n );\n break;\n default:\n if (obj.name !== this.name) {\n obj.size = 2;\n // 接收正常的聊天\n this.lists.push(obj);\n }\n }\n this.num = obj.num;\n this.$nextTick(() => {\n let Lis = document.querySelectorAll(\"li\"); // 查找所有li元素\n if (\n Lis[Lis.length - 1].offsetTop + 49 >\n this.$refs.scroll.$el.clientHeight\n ) {\n const height =\n Lis[Lis.length - 1].offsetTop +\n 49 -\n this.$refs.scroll.$el.clientHeight;\n this.$refs.scroll.scrollTo(0, -height, 100);\n this.$refs.scroll.refresh();\n }\n }, 0);\n },\n onClose() {\n // 当链接主动断开的时候触发close事件\n this.ws.close();\n },\n onError() {\n // 当连接失败时触发error事件\n // 连接失败之后1s进行断线重连\n var _this = this;\n setTimeout(function() {\n _this.init();\n }, 1000);\n },\n // 发送消息\n send() {\n var minemsg = {\n name: this.name,\n message: this.message,\n size: 1,\n date: new Date(),\n uid: this.uid\n };\n this.lists.push(minemsg);\n this.$nextTick(() => {\n let Lis = document.querySelectorAll(\"li\"); // 查找所有li元素\n if (\n Lis[Lis.length - 1].offsetTop + 49 >\n this.$refs.scroll.$el.clientHeight\n ) {\n const height =\n Lis[Lis.length - 1].offsetTop +\n 49 -\n this.$refs.scroll.$el.clientHeight;\n this.$refs.scroll.scrollTo(0, -height, 100);\n this.$refs.scroll.refresh();\n }\n }, 0);\n this.ws.send(\n JSON.stringify({\n event: \"message\",\n message: this.message,\n name: this.name,\n uid: this.uid,\n date: new Date()\n })\n );\n this.message = \"\";\n },\n checkServer: function() {\n var _this = this;\n clearTimeout(this.handle);\n this.handle = setTimeout(function() {\n _this.onClose();\n setTimeout(function() {\n _this.init();\n }, 1000);\n // 设置1ms的时延调试在服务器测未及时响应时客户端的反应\n }, 30000 + 1000);\n }\n },\n mounted() {\n this.name = window.localStorage.getItem(\"name\");\n this.uid = window.localStorage.getItem(\"userId\");\n var othis = this;\n othis.enter();\n }\n};\n</script>\n\n<style scoped>\n#chat {\n position: relative;\n height: 100vh;\n background-color: #f5f5f5;\n}\n.nav-bar {\n top: 0px;\n position: absolute;\n width: 100%;\n background-color: #df3832;\n font-weight: 500px;\n color: #fff;\n box-shadow: 1px solid #333;\n}\n.back {\n position: relative;\n width: 30px;\n height: 30px;\n left: 10px;\n top: 50%;\n transform: translate(0, -50%);\n}\n.content {\n left: 0;\n right: 0;\n top: 44px;\n bottom: 44px;\n overflow: hidden;\n position: absolute;\n}\n\n.showcomment {\n position: fixed;\n display: flex;\n bottom: 0;\n width: 100%;\n height: 44px;\n background-color: #f0f0f0;\n}\n\n/* .showcomment .warp {\n background-color: #fff;\n position: relative;\n width: 70%;\n top: 50%;\n transform: translate(0, -50%);\n border-radius: 50px;\n left: 5%;\n height: 30px;\n}\n\n.showcomment .warp {\n color: #333;\n font-weight: 400;\n} */\n\n.showcomment input {\n width: 70%;\n padding: 0 20px;\n position: relative;\n height: 25px;\n border: none;\n top: 50%;\n left: 40%;\n transform: translate(-50%, -50%);\n border-radius: 30px;\n}\n\n.showcomment span {\n display: inline-block;\n margin: auto auto;\n color: #333;\n}\n.minienter {\n margin-top: 5px;\n font-size: 10px;\n text-align: center;\n color: #555;\n font-weight: 400;\n}\n.minemsg {\n margin-top: 10px;\n font-size: 18px;\n color: #333;\n font-weight: 400;\n display: flex;\n flex-direction: row-reverse;\n}\n.minemsg img {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n}\n\n.minemsg .mine-bottom {\n text-align: right;\n}\n\n.minemsg .mine-bottom .msg {\n display: inline-block;\n margin: 3px 3px;\n padding: 5px 5px;\n background-color: #fff;\n border-radius: 10px;\n font-size: 18px;\n}\n.minemsg .mine-bottom .namefont {\n text-align: right;\n font-size: 12px;\n color: #999;\n font-weight: 400;\n}\n.minemsg .mine-bottom .namefont span {\n text-align: right;\n font-size: 10px;\n color: #999;\n font-weight: 400;\n}\n\n.othermsg {\n display: flex;\n margin-top: 10px;\n font-size: 18px;\n color: #333;\n}\n.othermsg img {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n}\n\n.othermsg .mine-bottom {\n text-align: left;\n}\n\n.othermsg .mine-bottom .msg {\n display: inline-block;\n padding: 3px 3px;\n background-color: #fff;\n border-radius: 10px;\n font-size: 18px;\n}\n.othermsg .mine-bottom .namefont {\n font-size: 12px;\n color: #999;\n font-weight: 400;\n font-size: 12px;\n}\n.othermsg .mine-bottom .namefont span {\n font-size: 10px;\n color: #999;\n font-weight: 400;\n font-size: 10px;\n}\n</style>\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DetailChat.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DetailChat.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./DetailChat.vue?vue&type=template&id=8ea6cd00&scoped=true&\"\nimport script from \"./DetailChat.vue?vue&type=script&lang=js&\"\nexport * from \"./DetailChat.vue?vue&type=script&lang=js&\"\nimport style0 from \"./DetailChat.vue?vue&type=style&index=0&id=8ea6cd00&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"8ea6cd00\",\n null\n \n)\n\nexport default component.exports","module.exports = __webpack_public_path__ + \"img/back.8059563a.svg\";","import mod from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DetailChat.vue?vue&type=style&index=0&id=8ea6cd00&scoped=true&lang=css&\"; export default mod; export * from \"-!../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DetailChat.vue?vue&type=style&index=0&id=8ea6cd00&scoped=true&lang=css&\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{ref:\"wrapper\",staticClass:\"wrapper\"},[_c('div',{staticClass:\"content\"},[_vm._t(\"default\")],2)])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\n <div class=\"wrapper\" ref=\"wrapper\">\n <div class=\"content\">\n <slot></slot>\n </div>\n </div>\n</template>\n\n<script>\nimport BScroll from \"better-scroll\";\nexport default {\n name: \"Scroll\",\n props: {\n probeType: {\n type: Number,\n default: 0\n },\n pullUpLoad: {\n type: Boolean,\n default: false\n },\n pullDownLoad: {\n type: Boolean,\n default: false\n }\n },\n data() {\n return {\n scroll: null\n };\n },\n mounted() {\n this.$nextTick(() => {\n this.scroll = new BScroll(this.$refs.wrapper, {\n click: true,\n probeType: this.probeType,\n pullUpLoad: {\n threshold: 80,\n stop: 80\n },\n useTransition: false,\n pullDownRefresh: {\n threshold: 40,\n stop: 30\n },\n disableMouse: false,\n disableTouch: false\n });\n\n this.scroll.on(\"scroll\", position => {\n this.$emit(\"scrollw\", position);\n });\n\n this.scroll.on(\"pullingUp\", () => {\n this.$emit(\"pullingUp\");\n });\n\n this.scroll.on(\"pullingDown\", () => {\n this.$emit(\"pullingDown\");\n });\n\n this.scroll.scrollTo(0, 0);\n });\n },\n methods: {\n scrollTo(x, y, timer = 3000) {\n this.scroll && this.scroll.scrollTo(x, y, timer);\n },\n finishPullUp() {\n this.refresh();\n this.scroll && this.scroll.finishPullUp();\n },\n finishPullDown() {\n this.refresh();\n this.scroll && this.scroll.finishPullDown();\n },\n\n refresh() {\n this.scroll && this.scroll.refresh();\n },\n getScrollY() {\n return this.scroll ? this.scroll.y : 0;\n }\n }\n};\n</script>\n\n<style scoped></style>\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Scroll.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Scroll.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Scroll.vue?vue&type=template&id=62c7f78a&scoped=true&\"\nimport script from \"./Scroll.vue?vue&type=script&lang=js&\"\nexport * from \"./Scroll.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"62c7f78a\",\n null\n \n)\n\nexport default component.exports","var DESCRIPTORS = require('../internals/descriptors');\nvar defineProperty = require('../internals/object-define-property').f;\n\nvar FunctionPrototype = Function.prototype;\nvar FunctionPrototypeToString = FunctionPrototype.toString;\nvar nameRE = /^\\s*function ([^ (]*)/;\nvar NAME = 'name';\n\n// Function instances `.name` property\n// https://tc39.github.io/ecma262/#sec-function-instances-name\nif (DESCRIPTORS && !(NAME in FunctionPrototype)) {\n defineProperty(FunctionPrototype, NAME, {\n configurable: true,\n get: function () {\n try {\n return FunctionPrototypeToString.call(this).match(nameRE)[1];\n } catch (error) {\n return '';\n }\n }\n });\n}\n","var fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;\n });\n};\n"],"sourceRoot":""}