index.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/ // Check if module is in cache
  8. /******/ if(installedModules[moduleId])
  9. /******/ return installedModules[moduleId].exports;
  10. /******/ // Create a new module (and put it into the cache)
  11. /******/ var module = installedModules[moduleId] = {
  12. /******/ i: moduleId,
  13. /******/ l: false,
  14. /******/ exports: {}
  15. /******/ };
  16. /******/ // Execute the module function
  17. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  18. /******/ // Flag the module as loaded
  19. /******/ module.l = true;
  20. /******/ // Return the exports of the module
  21. /******/ return module.exports;
  22. /******/ }
  23. /******/ // expose the modules object (__webpack_modules__)
  24. /******/ __webpack_require__.m = modules;
  25. /******/ // expose the module cache
  26. /******/ __webpack_require__.c = installedModules;
  27. /******/ // identity function for calling harmony imports with the correct context
  28. /******/ __webpack_require__.i = function(value) { return value; };
  29. /******/ // define getter function for harmony exports
  30. /******/ __webpack_require__.d = function(exports, name, getter) {
  31. /******/ if(!__webpack_require__.o(exports, name)) {
  32. /******/ Object.defineProperty(exports, name, {
  33. /******/ configurable: false,
  34. /******/ enumerable: true,
  35. /******/ get: getter
  36. /******/ });
  37. /******/ }
  38. /******/ };
  39. /******/ // getDefaultExport function for compatibility with non-harmony modules
  40. /******/ __webpack_require__.n = function(module) {
  41. /******/ var getter = module && module.__esModule ?
  42. /******/ function getDefault() { return module['default']; } :
  43. /******/ function getModuleExports() { return module; };
  44. /******/ __webpack_require__.d(getter, 'a', getter);
  45. /******/ return getter;
  46. /******/ };
  47. /******/ // Object.prototype.hasOwnProperty.call
  48. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  49. /******/ // __webpack_public_path__
  50. /******/ __webpack_require__.p = "";
  51. /******/ // Load entry module and return exports
  52. /******/ return __webpack_require__(__webpack_require__.s = 227);
  53. /******/ })
  54. /************************************************************************/
  55. /******/ ({
  56. /***/ 0:
  57. /***/ function(module, exports) {
  58. /* globals __VUE_SSR_CONTEXT__ */
  59. // this module is a runtime utility for cleaner component module output and will
  60. // be included in the final webpack user bundle
  61. module.exports = function normalizeComponent (
  62. rawScriptExports,
  63. compiledTemplate,
  64. injectStyles,
  65. scopeId,
  66. moduleIdentifier /* server only */
  67. ) {
  68. var esModule
  69. var scriptExports = rawScriptExports = rawScriptExports || {}
  70. // ES6 modules interop
  71. var type = typeof rawScriptExports.default
  72. if (type === 'object' || type === 'function') {
  73. esModule = rawScriptExports
  74. scriptExports = rawScriptExports.default
  75. }
  76. // Vue.extend constructor export interop
  77. var options = typeof scriptExports === 'function'
  78. ? scriptExports.options
  79. : scriptExports
  80. // render functions
  81. if (compiledTemplate) {
  82. options.render = compiledTemplate.render
  83. options.staticRenderFns = compiledTemplate.staticRenderFns
  84. }
  85. // scopedId
  86. if (scopeId) {
  87. options._scopeId = scopeId
  88. }
  89. var hook
  90. if (moduleIdentifier) { // server build
  91. hook = function (context) {
  92. // 2.3 injection
  93. context =
  94. context || // cached call
  95. (this.$vnode && this.$vnode.ssrContext) || // stateful
  96. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  97. // 2.2 with runInNewContext: true
  98. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  99. context = __VUE_SSR_CONTEXT__
  100. }
  101. // inject component styles
  102. if (injectStyles) {
  103. injectStyles.call(this, context)
  104. }
  105. // register component module identifier for async chunk inferrence
  106. if (context && context._registeredComponents) {
  107. context._registeredComponents.add(moduleIdentifier)
  108. }
  109. }
  110. // used by ssr in case component is cached and beforeCreate
  111. // never gets called
  112. options._ssrRegister = hook
  113. } else if (injectStyles) {
  114. hook = injectStyles
  115. }
  116. if (hook) {
  117. var functional = options.functional
  118. var existing = functional
  119. ? options.render
  120. : options.beforeCreate
  121. if (!functional) {
  122. // inject component registration as beforeCreate hook
  123. options.beforeCreate = existing
  124. ? [].concat(existing, hook)
  125. : [hook]
  126. } else {
  127. // register for functioal component in vue file
  128. options.render = function renderWithStyleInjection (h, context) {
  129. hook.call(context)
  130. return existing(h, context)
  131. }
  132. }
  133. }
  134. return {
  135. esModule: esModule,
  136. exports: scriptExports,
  137. options: options
  138. }
  139. }
  140. /***/ },
  141. /***/ 115:
  142. /***/ function(module, exports) {
  143. // removed by extract-text-webpack-plugin
  144. /***/ },
  145. /***/ 145:
  146. /***/ function(module, exports, __webpack_require__) {
  147. function injectStyle (ssrContext) {
  148. __webpack_require__(115)
  149. }
  150. var Component = __webpack_require__(0)(
  151. /* script */
  152. __webpack_require__(67),
  153. /* template */
  154. __webpack_require__(185),
  155. /* styles */
  156. injectStyle,
  157. /* scopeId */
  158. null,
  159. /* moduleIdentifier (server only) */
  160. null
  161. )
  162. module.exports = Component.exports
  163. /***/ },
  164. /***/ 185:
  165. /***/ function(module, exports) {
  166. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  167. return _c('div', {
  168. staticClass: "mint-palette-button",
  169. class: {
  170. expand: _vm.expanded, 'mint-palette-button-active': _vm.transforming
  171. },
  172. on: {
  173. "animationend": _vm.onMainAnimationEnd,
  174. "webkitAnimationEnd": _vm.onMainAnimationEnd,
  175. "mozAnimationEnd": _vm.onMainAnimationEnd
  176. }
  177. }, [_c('div', {
  178. staticClass: "mint-sub-button-container"
  179. }, [_vm._t("default")], 2), _vm._v(" "), _c('div', {
  180. staticClass: "mint-main-button",
  181. style: (_vm.mainButtonStyle),
  182. on: {
  183. "touchstart": _vm.toggle
  184. }
  185. }, [_vm._v("\n " + _vm._s(_vm.content) + "\n ")])])
  186. },staticRenderFns: []}
  187. /***/ },
  188. /***/ 227:
  189. /***/ function(module, exports, __webpack_require__) {
  190. module.exports = __webpack_require__(35);
  191. /***/ },
  192. /***/ 35:
  193. /***/ function(module, exports, __webpack_require__) {
  194. "use strict";
  195. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_palette_button_vue__ = __webpack_require__(145);
  196. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_palette_button_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_palette_button_vue__);
  197. Object.defineProperty(exports, "__esModule", { value: true });
  198. /* harmony reexport (default from non-hamory) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_palette_button_vue___default.a; });
  199. /***/ },
  200. /***/ 67:
  201. /***/ function(module, exports, __webpack_require__) {
  202. "use strict";
  203. Object.defineProperty(exports, "__esModule", { value: true });
  204. //
  205. //
  206. //
  207. //
  208. //
  209. //
  210. //
  211. //
  212. //
  213. //
  214. //
  215. //
  216. /* harmony default export */ exports["default"] = {
  217. name: 'mt-palette-button',
  218. data: function() {
  219. return {
  220. transforming: false, // 是否正在执行动画
  221. expanded: false // 是否已经展开子按钮
  222. };
  223. },
  224. props: {
  225. content: {
  226. type: String,
  227. default: ''
  228. },
  229. offset: {
  230. type: Number, // 扇面偏移角,默认是四分之π,配合默认方向lt
  231. default: Math.PI / 4
  232. },
  233. direction: {
  234. type: String,
  235. default: 'lt' // lt t rt this.radius rb b lb l 取值有8个方向,左上、上、右上、右、右下、下、左下、左,默认为左上
  236. },
  237. radius: {
  238. type: Number,
  239. default: 90
  240. },
  241. mainButtonStyle: {
  242. type: String, // 应用到 mint-main-button 上的 class
  243. default: ''
  244. }
  245. },
  246. methods: {
  247. toggle: function toggle(event) {
  248. if (!this.transforming) {
  249. if (this.expanded) {
  250. this.collapse(event);
  251. } else {
  252. this.expand(event);
  253. }
  254. }
  255. },
  256. onMainAnimationEnd: function onMainAnimationEnd(event) {
  257. this.transforming = false;
  258. this.$emit('expanded');
  259. },
  260. expand: function expand(event) {
  261. this.expanded = true;
  262. this.transforming = true;
  263. this.$emit('expand', event);
  264. },
  265. collapse: function collapse(event) {
  266. this.expanded = false;
  267. this.$emit('collapse', event);
  268. }
  269. },
  270. mounted: function mounted() {
  271. var this$1 = this;
  272. this.slotChildren = [];
  273. for (var i = 0; i < this.$slots.default.length; i++) {
  274. if (this$1.$slots.default[i].elm.nodeType !== 3) {
  275. this$1.slotChildren.push(this$1.$slots.default[i]);
  276. }
  277. }
  278. var css = '';
  279. var direction_arc = Math.PI * (3 + Math.max(['lt', 't', 'rt', 'r', 'rb', 'b', 'lb', 'l'].indexOf(this.direction), 0)) / 4;
  280. for (var i$1 = 0; i$1 < this.slotChildren.length; i$1++) {
  281. var arc = (Math.PI - this$1.offset * 2) / (this$1.slotChildren.length - 1) * i$1 + this$1.offset + direction_arc;
  282. var x = (Math.cos(arc) * this$1.radius).toFixed(2);
  283. var y = (Math.sin(arc) * this$1.radius).toFixed(2);
  284. var item_css = '.expand .palette-button-' + this$1._uid + '-sub-' + i$1 + '{transform:translate(' + x + 'px,' + y + 'px) rotate(720deg);transition-delay:' + 0.03 * i$1 + 's}';
  285. css += item_css;
  286. this$1.slotChildren[i$1].elm.className += (' palette-button-' + this$1._uid + '-sub-' + i$1);
  287. }
  288. this.styleNode = document.createElement('style');
  289. this.styleNode.type = 'text/css';
  290. this.styleNode.rel = 'stylesheet';
  291. this.styleNode.title = 'palette button style';
  292. this.styleNode.appendChild(document.createTextNode(css));
  293. document.getElementsByTagName('head')[0].appendChild(this.styleNode);
  294. },
  295. destroyed: function destroyed() {
  296. if (this.styleNode) {
  297. this.styleNode.parentNode.removeChild(this.styleNode);
  298. }
  299. }
  300. };
  301. /***/ }
  302. /******/ });