Repository: yelingfeng/vuex-tutorial Branch: master Commit: 94721b8129a8 Files: 74 Total size: 1.2 MB Directory structure: gitextract_cn36t50l/ ├── .babelrc ├── .eslintrc ├── README.md ├── amd/ │ ├── index.html │ └── src/ │ ├── api/ │ │ └── index.js │ ├── assets/ │ │ ├── css/ │ │ │ └── md-facefont.css │ │ ├── font/ │ │ │ ├── iconfont/ │ │ │ │ ├── MaterialIcons-Regular.ijmap │ │ │ │ ├── README.md │ │ │ │ └── codepoints │ │ │ └── material-design-icons/ │ │ │ └── LICENSE.txt │ │ └── js/ │ │ ├── bootstrap/ │ │ │ ├── css/ │ │ │ │ ├── bootstrap-theme.css │ │ │ │ └── bootstrap.css │ │ │ └── js/ │ │ │ ├── bootstrap.js │ │ │ └── npm.js │ │ └── bootstrap-material-design/ │ │ ├── css/ │ │ │ ├── bootstrap-material-design.css │ │ │ └── ripples.css │ │ └── js/ │ │ ├── material.js │ │ └── ripples.js │ ├── component/ │ │ ├── App.js │ │ ├── List.js │ │ ├── Search.js │ │ └── SearchGroup.js │ ├── config.js │ ├── lib/ │ │ ├── vue.js │ │ └── vuex.js │ ├── main.js │ ├── require.js │ └── vuex/ │ ├── actions.js │ ├── getters.js │ ├── modules/ │ │ ├── search.js │ │ └── searchGroup.js │ ├── mutation-types.js │ └── store.js ├── gulpfile.babel.js ├── index.html ├── package.json ├── server.js ├── src/ │ ├── api/ │ │ ├── index.js │ │ └── resource.js │ ├── assets/ │ │ ├── css/ │ │ │ └── md-facefont.css │ │ ├── font/ │ │ │ ├── iconfont/ │ │ │ │ ├── MaterialIcons-Regular.ijmap │ │ │ │ ├── README.md │ │ │ │ └── codepoints │ │ │ └── material-design-icons/ │ │ │ └── LICENSE.txt │ │ └── js/ │ │ └── bootstrap-material-design/ │ │ ├── css/ │ │ │ ├── bootstrap-material-design.css │ │ │ └── ripples.css │ │ └── js/ │ │ ├── material.js │ │ └── ripples.js │ ├── components/ │ │ ├── App.vue │ │ ├── List.vue │ │ ├── Search.vue │ │ └── SearchGroup.vue │ ├── config.js │ ├── index.html │ ├── main.js │ └── vuex/ │ ├── actions.js │ ├── getters.js │ ├── middlewares.js │ ├── modules/ │ │ ├── search.js │ │ └── searchGroup.js │ ├── mutation-types.js │ └── store.js ├── tutorial/ │ ├── 01.md │ ├── 02.md │ ├── 03/ │ │ ├── INFO.md │ │ ├── index.html │ │ ├── lib/ │ │ │ ├── old/ │ │ │ │ └── vuex.js │ │ │ ├── vue.js │ │ │ └── vuex.js │ │ └── old.html │ └── 03.md ├── webpack.config.dev.js ├── webpack.config.js └── webpack.config.prod.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .babelrc ================================================ { "presets": ["es2015", "stage-2"], "plugins": ["transform-runtime","add-module-exports"], "comments": false } ================================================ FILE: .eslintrc ================================================ { "env": { "browser": true, "node": true }, "ecmaFeatures": { "arrowFunctions": true, "destructuring": true, "classes": true, "defaultParams": true, "blockBindings": true, "modules": true, "objectLiteralComputedProperties": true, "objectLiteralShorthandMethods": true, "objectLiteralShorthandProperties": true, "restParams": true, "spread": true, "templateStrings": true }, "rules": { "accessor-pairs": 2, "array-bracket-spacing": 0, "block-scoped-var": 0, "brace-style": [2, "1tbs", { "allowSingleLine": true }], "camelcase": 0, "comma-dangle": [2, "never"], "comma-spacing": [2, { "before": false, "after": true }], "comma-style": [2, "last"], "complexity": 0, "computed-property-spacing": 0, "consistent-return": 0, "consistent-this": 0, "constructor-super": 2, "curly": [2, "multi-line"], "default-case": 0, "dot-location": [2, "property"], "dot-notation": 0, "eol-last": 2, "eqeqeq": [2, "allow-null"], "func-names": 0, "func-style": 0, "generator-star-spacing": [2, { "before": true, "after": true }], "guard-for-in": 0, "handle-callback-err": [2, "^(err|error)$" ], "indent": [2, 2, { "SwitchCase": 1 }], "key-spacing": [2, { "beforeColon": false, "afterColon": true }], "linebreak-style": 0, "lines-around-comment": 0, "max-nested-callbacks": 0, "new-cap": [2, { "newIsCap": true, "capIsNew": false }], "new-parens": 2, "newline-after-var": 0, "no-alert": 0, "no-array-constructor": 2, "no-caller": 2, "no-catch-shadow": 0, "no-cond-assign": 2, "no-console": 0, "no-constant-condition": 0, "no-continue": 0, "no-control-regex": 2, "no-debugger": 2, "no-delete-var": 2, "no-div-regex": 0, "no-dupe-args": 2, "no-dupe-keys": 2, "no-duplicate-case": 2, "no-else-return": 0, "no-empty": 0, "no-empty-character-class": 2, "no-empty-label": 2, "no-eq-null": 0, "no-eval": 2, "no-ex-assign": 2, "no-extend-native": 2, "no-extra-bind": 2, "no-extra-boolean-cast": 2, "no-extra-parens": 0, "no-extra-semi": 0, "no-fallthrough": 2, "no-floating-decimal": 2, "no-func-assign": 2, "no-implied-eval": 2, "no-inline-comments": 0, "no-inner-declarations": [2, "functions"], "no-invalid-regexp": 2, "no-irregular-whitespace": 2, "no-iterator": 2, "no-label-var": 2, "no-labels": 2, "no-lone-blocks": 2, "no-lonely-if": 0, "no-loop-func": 0, "no-mixed-requires": 0, "no-mixed-spaces-and-tabs": 2, "no-multi-spaces": 2, "no-multi-str": 2, "no-multiple-empty-lines": [2, { "max": 1 }], "no-native-reassign": 2, "no-negated-in-lhs": 2, "no-nested-ternary": 0, "no-new": 0, "no-new-func": 0, "no-new-object": 2, "no-new-require": 2, "no-new-wrappers": 2, "no-obj-calls": 2, "no-octal": 2, "no-octal-escape": 2, "no-param-reassign": 0, "no-path-concat": 0, "no-process-env": 0, "no-process-exit": 0, "no-proto": 0, "no-redeclare": 2, "no-regex-spaces": 2, "no-restricted-modules": 0, "no-return-assign": 2, "no-script-url": 0, "no-self-compare": 2, "no-sequences": 2, "no-shadow": 0, "no-shadow-restricted-names": 2, "no-spaced-func": 2, "no-sparse-arrays": 2, "no-sync": 0, "no-ternary": 0, "no-this-before-super": 2, "no-throw-literal": 2, "no-trailing-spaces": 2, "no-undef": 2, "no-undef-init": 2, "no-undefined": 0, "no-underscore-dangle": 0, "no-unexpected-multiline": 2, "no-unneeded-ternary": 2, "no-unreachable": 2, "no-unused-expressions": 0, "no-unused-vars": [2, { "vars": "all", "args": "none" }], "no-use-before-define": 0, "no-var": 0, "no-void": 0, "no-warning-comments": 0, "no-with": 2, "object-curly-spacing": 0, "object-shorthand": 0, "one-var": [2, { "initialized": "never" }], "operator-assignment": 0, "operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }], "padded-blocks": 0, "prefer-const": 0, "quote-props": 0, "quotes": [2, "single", "avoid-escape"], "radix": 2, "semi": [2, "never"], "semi-spacing": 0, "sort-vars": 0, "space-after-keywords": [2, "always"], "space-before-blocks": [2, "always"], "space-before-function-paren": [2, "always"], "space-in-parens": [2, "never"], "space-infix-ops": 2, "space-return-throw-case": 2, "space-unary-ops": [2, { "words": true, "nonwords": false }], "spaced-comment": [2, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!"] }], "strict": 0, "use-isnan": 2, "valid-jsdoc": 0, "valid-typeof": 2, "vars-on-top": 0, "wrap-iife": [2, "any"], "wrap-regex": 0, "yoda": [2, "never"] } } ================================================ FILE: README.md ================================================ # vuex-tutorial > 一个`vuex`教程 主要介绍如何实际操作`vuex` [demo](http://yelingfeng.github.io/vuex-tutorial ) # newList - [x] [vuex2.x新旧变化整理](/tutorial/03/INFO.md) - [x] [requirejs快速构建教程](/tutorial/02.md) - [x] [新增amd版本](https://github.com/yelingfeng/vuex-tutorial/tree/master/amd) ## 前言 该代码示例使用的vue相关资源 详细看`package.json` 核心(`vue+vuex`) 其他相关参考[jackblog](https://github.com/jackhutu/jackblog-vue) 工程(使用了该项目的gulp和webpack配置) - [x] [Vuejs](https://github.com/vuejs/vue) - [x] [Vuex](https://github.com/vuejs/vuex) - [x] [Vue-resource](https://github.com/vuejs/vue-resource) - [x] [bootstrap-material-design](https://github.com/FezVrasta/bootstrap-material-design) # vuex 一句话介绍`vuex`是什么,官方说明"一个专门为 `Vue.js` 应用设计的状态管理架构" 状态管理: 简单理解就是统一管理和维护各个vue组件的可变化状态(你可以理解成`vue`组件里的某些`data`) ## 实战介绍 完成一个简单搜索查询功能 效果如下  ## 组件介绍 - `App` 主程序组件 - `Search` 搜索框组件 - `SearchGroup` 分组类型组件 - `List` 结果集合组件 ## 组件内actions说明 (这里主要描述调用逻辑 结果都是一个`list`) ### App `App`包含了组件`Search`和`List` > searchResultList 返回结果action 直接从`actions`获取放到`list`中 ### Search `Search`组件中包含子组件`SearchGroup` 主要包含功能 > searchAction 根据key进行查询action 放大镜和回车同时绑定了事件 > clearAction 清除key的值action ### SearchGroup > setSearchGroup 根据分组值进行查询action # 教程 - [目录结构](/tutorial/01.md) - [requirejs快速构建教程](/tutorial/02.md) - [TODOS2](/tutorial/03.md) # 环境准备 ### 初始化 ``` $ npm install ``` ### 开发 启动webpack环境 ``` npm run dev ``` 启动一个express服务器 ``` node server.js ``` ### 构建 ``` npm run build ``` # License MIT ================================================ FILE: amd/index.html ================================================
" + $input.attr("data-hint") + "
"); $input.removeAttr("data-hint"); } // Legacy - Change input-sm/lg to form-group-sm/lg instead (preferred standard and simpler css/less variants) var legacySizes = { "input-lg": "form-group-lg", "input-sm": "form-group-sm" }; $.each(legacySizes, function (legacySize, standardSize) { if ($input.hasClass(legacySize)) { $input.removeClass(legacySize); $formGroup.addClass(standardSize); } }); // Legacy - Add label-floating if using old shorthand if ($input.hasClass("floating-label")) { var placeholder = $input.attr("placeholder"); $input.attr("placeholder", null).removeClass("floating-label"); var id = $input.attr("id"); var forAttribute = ""; if (id) { forAttribute = "for='" + id + "'"; } $formGroup.addClass("label-floating"); $input.after(""); } // Set as empty if is empty (damn I must improve this...) if ($input.val() === null || $input.val() == "undefined" || $input.val() === "") { $formGroup.addClass("is-empty"); } // Add at the end of the form-group $formGroup.append(""); // Support for file input if ($formGroup.find("input[type=file]").length > 0) { $formGroup.addClass("is-fileinput"); } }); }, "attachInputEventHandlers": function () { var validate = this.options.validate; $(document) .on("change", ".checkbox input[type=checkbox]", function () { $(this).blur(); }) .on("keydown paste", ".form-control", function (e) { if (_isChar(e)) { $(this).closest(".form-group").removeClass("is-empty"); } }) .on("keyup change", ".form-control", function () { var $input = $(this); var $formGroup = $input.closest(".form-group"); var isValid = (typeof $input[0].checkValidity === "undefined" || $input[0].checkValidity()); if ($input.val() === "") { $formGroup.addClass("is-empty"); } else { $formGroup.removeClass("is-empty"); } // Validation events do not bubble, so they must be attached directly to the input: http://jsfiddle.net/PEpRM/1/ // Further, even the bind method is being caught, but since we are already calling #checkValidity here, just alter // the form-group on change. // // NOTE: I'm not sure we should be intervening regarding validation, this seems better as a README and snippet of code. // BUT, I've left it here for backwards compatibility. if (validate) { if (isValid) { $formGroup.removeClass("has-error"); } else { $formGroup.addClass("has-error"); } } }) .on("focus", ".form-control, .form-group.is-fileinput", function () { _addFormGroupFocus(this); }) .on("blur", ".form-control, .form-group.is-fileinput", function () { _removeFormGroupFocus(this); }) // make sure empty is added back when there is a programmatic value change. // NOTE: programmatic changing of value using $.val() must trigger the change event i.e. $.val('x').trigger('change') .on("change", ".form-group input", function () { var $input = $(this); if ($input.attr("type") == "file") { return; } var $formGroup = $input.closest(".form-group"); var value = $input.val(); if (value) { $formGroup.removeClass("is-empty"); } else { $formGroup.addClass("is-empty"); } }) // set the fileinput readonly field with the name of the file .on("change", ".form-group.is-fileinput input[type='file']", function () { var $input = $(this); var $formGroup = $input.closest(".form-group"); var value = ""; $.each(this.files, function (i, file) { value += file.name + ", "; }); value = value.substring(0, value.length - 2); if (value) { $formGroup.removeClass("is-empty"); } else { $formGroup.addClass("is-empty"); } $formGroup.find("input.form-control[readonly]").val(value); }); }, "ripples": function (selector) { $((selector) ? selector : this.options.withRipples).ripples(); }, "autofill": function () { // This part of code will detect autofill when the page is loading (username and password inputs for example) var loading = setInterval(function () { $("input[type!=checkbox]").each(function () { var $this = $(this); if ($this.val() && $this.val() !== $this.attr("value")) { $this.trigger("change"); } }); }, 100); // After 10 seconds we are quite sure all the needed inputs are autofilled then we can stop checking them setTimeout(function () { clearInterval(loading); }, 10000); }, "attachAutofillEventHandlers": function () { // Listen on inputs of the focused form (because user can select from the autofill dropdown only when the input has focus) var focused; $(document) .on("focus", "input", function () { var $inputs = $(this).parents("form").find("input").not("[type=file]"); focused = setInterval(function () { $inputs.each(function () { var $this = $(this); if ($this.val() !== $this.attr("value")) { $this.trigger("change"); } }); }, 100); }) .on("blur", ".form-group input", function () { clearInterval(focused); }); }, "init": function (options) { this.options = $.extend({}, this.options, options); var $document = $(document); if ($.fn.ripples && this.options.ripples) { this.ripples(); } if (this.options.input) { this.input(); this.attachInputEventHandlers(); } if (this.options.checkbox) { this.checkbox(); } if (this.options.togglebutton) { this.togglebutton(); } if (this.options.radio) { this.radio(); } if (this.options.autofill) { this.autofill(); this.attachAutofillEventHandlers(); } if (document.arrive && this.options.arrive) { if ($.fn.ripples && this.options.ripples) { $document.arrive(this.options.withRipples, function () { $.material.ripples($(this)); }); } if (this.options.input) { $document.arrive(this.options.inputElements, function () { $.material.input($(this)); }); } if (this.options.checkbox) { $document.arrive(this.options.checkboxElements, function () { $.material.checkbox($(this)); }); } if (this.options.radio) { $document.arrive(this.options.radioElements, function () { $.material.radio($(this)); }); } if (this.options.togglebutton) { $document.arrive(this.options.togglebuttonElements, function () { $.material.togglebutton($(this)); }); } } } }; })(jQuery); ================================================ FILE: amd/src/assets/js/bootstrap-material-design/js/ripples.js ================================================ /* Copyright 2014+, Federico Zivolo, LICENSE at https://github.com/FezVrasta/bootstrap-material-design/blob/master/LICENSE.md */ /* globals jQuery, navigator */ (function($, window, document, undefined) { "use strict"; /** * Define the name of the plugin */ var ripples = "ripples"; /** * Get an instance of the plugin */ var self = null; /** * Define the defaults of the plugin */ var defaults = {}; /** * Create the main plugin function */ function Ripples(element, options) { self = this; this.element = $(element); this.options = $.extend({}, defaults, options); this._defaults = defaults; this._name = ripples; this.init(); } /** * Initialize the plugin */ Ripples.prototype.init = function() { var $element = this.element; $element.on("mousedown touchstart", function(event) { /** * Verify if the user is just touching on a device and return if so */ if(self.isTouch() && event.type === "mousedown") { return; } /** * Verify if the current element already has a ripple wrapper element and * creates if it doesn't */ if(!($element.find(".ripple-container").length)) { $element.append(""); } /** * Find the ripple wrapper */ var $wrapper = $element.children(".ripple-container"); /** * Get relY and relX positions */ var relY = self.getRelY($wrapper, event); var relX = self.getRelX($wrapper, event); /** * If relY and/or relX are false, return the event */ if(!relY && !relX) { return; } /** * Get the ripple color */ var rippleColor = self.getRipplesColor($element); /** * Create the ripple element */ var $ripple = $(""); $ripple .addClass("ripple") .css({ "left": relX, "top": relY, "background-color": rippleColor }); /** * Append the ripple to the wrapper */ $wrapper.append($ripple); /** * Make sure the ripple has the styles applied (ugly hack but it works) */ (function() { return window.getComputedStyle($ripple[0]).opacity; })(); /** * Turn on the ripple animation */ self.rippleOn($element, $ripple); /** * Call the rippleEnd function when the transition "on" ends */ setTimeout(function() { self.rippleEnd($ripple); }, 500); /** * Detect when the user leaves the element */ $element.on("mouseup mouseleave touchend", function() { $ripple.data("mousedown", "off"); if($ripple.data("animating") === "off") { self.rippleOut($ripple); } }); }); }; /** * Get the new size based on the element height/width and the ripple width */ Ripples.prototype.getNewSize = function($element, $ripple) { return (Math.max($element.outerWidth(), $element.outerHeight()) / $ripple.outerWidth()) * 2.5; }; /** * Get the relX */ Ripples.prototype.getRelX = function($wrapper, event) { var wrapperOffset = $wrapper.offset(); if(!self.isTouch()) { /** * Get the mouse position relative to the ripple wrapper */ return event.pageX - wrapperOffset.left; } else { /** * Make sure the user is using only one finger and then get the touch * position relative to the ripple wrapper */ event = event.originalEvent; if(event.touches.length === 1) { return event.touches[0].pageX - wrapperOffset.left; } return false; } }; /** * Get the relY */ Ripples.prototype.getRelY = function($wrapper, event) { var wrapperOffset = $wrapper.offset(); if(!self.isTouch()) { /** * Get the mouse position relative to the ripple wrapper */ return event.pageY - wrapperOffset.top; } else { /** * Make sure the user is using only one finger and then get the touch * position relative to the ripple wrapper */ event = event.originalEvent; if(event.touches.length === 1) { return event.touches[0].pageY - wrapperOffset.top; } return false; } }; /** * Get the ripple color */ Ripples.prototype.getRipplesColor = function($element) { var color = $element.data("ripple-color") ? $element.data("ripple-color") : window.getComputedStyle($element[0]).color; return color; }; /** * Verify if the client browser has transistion support */ Ripples.prototype.hasTransitionSupport = function() { var thisBody = document.body || document.documentElement; var thisStyle = thisBody.style; var support = ( thisStyle.transition !== undefined || thisStyle.WebkitTransition !== undefined || thisStyle.MozTransition !== undefined || thisStyle.MsTransition !== undefined || thisStyle.OTransition !== undefined ); return support; }; /** * Verify if the client is using a mobile device */ Ripples.prototype.isTouch = function() { return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); }; /** * End the animation of the ripple */ Ripples.prototype.rippleEnd = function($ripple) { $ripple.data("animating", "off"); if($ripple.data("mousedown") === "off") { self.rippleOut($ripple); } }; /** * Turn off the ripple effect */ Ripples.prototype.rippleOut = function($ripple) { $ripple.off(); if(self.hasTransitionSupport()) { $ripple.addClass("ripple-out"); } else { $ripple.animate({"opacity": 0}, 100, function() { $ripple.trigger("transitionend"); }); } $ripple.on("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function() { $ripple.remove(); }); }; /** * Turn on the ripple effect */ Ripples.prototype.rippleOn = function($element, $ripple) { var size = self.getNewSize($element, $ripple); if(self.hasTransitionSupport()) { $ripple .css({ "-ms-transform": "scale(" + size + ")", "-moz-transform": "scale(" + size + ")", "-webkit-transform": "scale(" + size + ")", "transform": "scale(" + size + ")" }) .addClass("ripple-on") .data("animating", "on") .data("mousedown", "on"); } else { $ripple.animate({ "width": Math.max($element.outerWidth(), $element.outerHeight()) * 2, "height": Math.max($element.outerWidth(), $element.outerHeight()) * 2, "margin-left": Math.max($element.outerWidth(), $element.outerHeight()) * (-1), "margin-top": Math.max($element.outerWidth(), $element.outerHeight()) * (-1), "opacity": 0.2 }, 500, function() { $ripple.trigger("transitionend"); }); } }; /** * Create the jquery plugin function */ $.fn.ripples = function(options) { return this.each(function() { if(!$.data(this, "plugin_" + ripples)) { $.data(this, "plugin_" + ripples, new Ripples(this, options)); } }); }; })(jQuery, window, document); ================================================ FILE: amd/src/component/App.js ================================================ /** * Created by on 2016/3/25. */ define(function(require){ var Vue = require("vue"); var searchComponent = require("component/Search"); var searchList = require("component/List"); var app = Vue.extend({ template : "#app-template", vuex :{ getters : { searchResultList: function(store){ return store.search.searchResultList } } }, components:{ searchComponent : searchComponent, searchList : searchList } }); return app }); ================================================ FILE: amd/src/component/List.js ================================================ define(function(require){ var Vue = require("vue"); return Vue.extend({ template : "#list-template", props:['data'], computed : { isEmpty : function(){ return this.data.length == 0 ; } } }); }); ================================================ FILE: amd/src/component/Search.js ================================================ define(function(require){ var Vue = require("vue"); var SearchGroup = require("component/SearchGroup"); var actions = require("vuex/actions") var getters = require("vuex/getters"); return Vue.extend({ vuex :{ getters : { searchGroupItem: function(store){ return store.searchGroup.searchGroupItem }, searchGroup:function(store){ return store.searchGroup.searchGroup }, searchKey : function(store){ return store.search.searchKey }, isEmptySearchKey : getters.isEmptySearchKey }, actions: { searchParamList:actions.searchParamList , clearSearchKey:actions.clearSearchKey, updateSearchKey:actions.updateSearchKey } }, methods : { clearAction:function(){ this.clearSearchKey() }, searchAction:function(e){ if(this.searchKey.length){ this.searchParamList(this.searchGroup,this.searchKey) } }, update:function(e){ this.updateSearchKey(e.target.value) } }, template : "#search-template", components:{ searchGroup:SearchGroup } }); }); ================================================ FILE: amd/src/component/SearchGroup.js ================================================ define(function(require){ var actions = require("vuex/actions"); var Vue = require("vue"); return Vue.extend({ template: "#searchgroup-template", vuex : { getters : { searchKey : function(store){ return store.search.searchKey; }, searchGroup : function(store){ return store.searchGroup.searchGroup } }, actions : { setSearchGroup :actions.setSearchGroup } }, computed : { curName : function(){ let cname ; this.items.forEach((it) =>{ if(it.value == this.searchGroup) cname = it.name }) return cname } }, methods : { menuClick : function(it){ this.setSearchGroup(it.value,this.searchKey) } }, components:{ }, props : ['items'] }) }) ================================================ FILE: amd/src/config.js ================================================ require.config({ baseUrl : "./src", paths :{ jquery:"./lib/jquery.min", vue:"./lib/vue", vueResource:"./lib/vue-resource.min", vueX:"./lib/vuex", api :"./api/index", lodash : "./lib/lodash.min", bootstrap : "./assets/js/bootstrap/js/bootstrap.min", ripples : "./assets/js/bootstrap-material-design/js/ripples.min", material:"./assets/js/bootstrap-material-design/js/material.min" }, shim : { bootstrap : ['jquery'], ripples:['jquery'], material:['jquery'], }, packages: [ { name: 'components', location: 'component', main: 'components' }, { name : "vuex", location :"vuex", main : "vuex" } ] }) require(["./main"]) ================================================ FILE: amd/src/lib/vue.js ================================================ /*! * Vue.js v1.0.21 * (c) 2016 Evan You * Released under the MIT License. */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.Vue = factory()); }(this, function () { 'use strict'; function set(obj, key, val) { if (hasOwn(obj, key)) { obj[key] = val; return; } if (obj._isVue) { set(obj._data, key, val); return; } var ob = obj.__ob__; if (!ob) { obj[key] = val; return; } ob.convert(key, val); ob.dep.notify(); if (ob.vms) { var i = ob.vms.length; while (i--) { var vm = ob.vms[i]; vm._proxy(key); vm._digest(); } } return val; } /** * Delete a property and trigger change if necessary. * * @param {Object} obj * @param {String} key */ function del(obj, key) { if (!hasOwn(obj, key)) { return; } delete obj[key]; var ob = obj.__ob__; if (!ob) { return; } ob.dep.notify(); if (ob.vms) { var i = ob.vms.length; while (i--) { var vm = ob.vms[i]; vm._unproxy(key); vm._digest(); } } } var hasOwnProperty = Object.prototype.hasOwnProperty; /** * Check whether the object has the property. * * @param {Object} obj * @param {String} key * @return {Boolean} */ function hasOwn(obj, key) { return hasOwnProperty.call(obj, key); } /** * Check if an expression is a literal value. * * @param {String} exp * @return {Boolean} */ var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/; function isLiteral(exp) { return literalValueRE.test(exp); } /** * Check if a string starts with $ or _ * * @param {String} str * @return {Boolean} */ function isReserved(str) { var c = (str + '').charCodeAt(0); return c === 0x24 || c === 0x5F; } /** * Guard text output, make sure undefined outputs * empty string * * @param {*} value * @return {String} */ function _toString(value) { return value == null ? '' : value.toString(); } /** * Check and convert possible numeric strings to numbers * before setting back to data * * @param {*} value * @return {*|Number} */ function toNumber(value) { if (typeof value !== 'string') { return value; } else { var parsed = Number(value); return isNaN(parsed) ? value : parsed; } } /** * Convert string boolean literals into real booleans. * * @param {*} value * @return {*|Boolean} */ function toBoolean(value) { return value === 'true' ? true : value === 'false' ? false : value; } /** * Strip quotes from a string * * @param {String} str * @return {String | false} */ function stripQuotes(str) { var a = str.charCodeAt(0); var b = str.charCodeAt(str.length - 1); return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str; } /** * Camelize a hyphen-delmited string. * * @param {String} str * @return {String} */ var camelizeRE = /-(\w)/g; function camelize(str) { return str.replace(camelizeRE, toUpper); } function toUpper(_, c) { return c ? c.toUpperCase() : ''; } /** * Hyphenate a camelCase string. * * @param {String} str * @return {String} */ var hyphenateRE = /([a-z\d])([A-Z])/g; function hyphenate(str) { return str.replace(hyphenateRE, '$1-$2').toLowerCase(); } /** * Converts hyphen/underscore/slash delimitered names into * camelized classNames. * * e.g. my-component => MyComponent * some_else => SomeElse * some/comp => SomeComp * * @param {String} str * @return {String} */ var classifyRE = /(?:^|[-_\/])(\w)/g; function classify(str) { return str.replace(classifyRE, toUpper); } /** * Simple bind, faster than native * * @param {Function} fn * @param {Object} ctx * @return {Function} */ function bind(fn, ctx) { return function (a) { var l = arguments.length; return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx); }; } /** * Convert an Array-like object to a real Array. * * @param {Array-like} list * @param {Number} [start] - start index * @return {Array} */ function toArray(list, start) { start = start || 0; var i = list.length - start; var ret = new Array(i); while (i--) { ret[i] = list[i + start]; } return ret; } /** * Mix properties into target object. * * @param {Object} to * @param {Object} from */ function extend(to, from) { var keys = Object.keys(from); var i = keys.length; while (i--) { to[keys[i]] = from[keys[i]]; } return to; } /** * Quick object check - this is primarily used to tell * Objects from primitive values when we know the value * is a JSON-compliant type. * * @param {*} obj * @return {Boolean} */ function isObject(obj) { return obj !== null && typeof obj === 'object'; } /** * Strict object type check. Only returns true * for plain JavaScript objects. * * @param {*} obj * @return {Boolean} */ var toString = Object.prototype.toString; var OBJECT_STRING = '[object Object]'; function isPlainObject(obj) { return toString.call(obj) === OBJECT_STRING; } /** * Array type check. * * @param {*} obj * @return {Boolean} */ var isArray = Array.isArray; /** * Define a property. * * @param {Object} obj * @param {String} key * @param {*} val * @param {Boolean} [enumerable] */ function def(obj, key, val, enumerable) { Object.defineProperty(obj, key, { value: val, enumerable: !!enumerable, writable: true, configurable: true }); } /** * Debounce a function so it only gets called after the * input stops arriving after the given wait period. * * @param {Function} func * @param {Number} wait * @return {Function} - the debounced function */ function _debounce(func, wait) { var timeout, args, context, timestamp, result; var later = function later() { var last = Date.now() - timestamp; if (last < wait && last >= 0) { timeout = setTimeout(later, wait - last); } else { timeout = null; result = func.apply(context, args); if (!timeout) context = args = null; } }; return function () { context = this; args = arguments; timestamp = Date.now(); if (!timeout) { timeout = setTimeout(later, wait); } return result; }; } /** * Manual indexOf because it's slightly faster than * native. * * @param {Array} arr * @param {*} obj */ function indexOf(arr, obj) { var i = arr.length; while (i--) { if (arr[i] === obj) return i; } return -1; } /** * Make a cancellable version of an async callback. * * @param {Function} fn * @return {Function} */ function cancellable(fn) { var cb = function cb() { if (!cb.cancelled) { return fn.apply(this, arguments); } }; cb.cancel = function () { cb.cancelled = true; }; return cb; } /** * Check if two values are loosely equal - that is, * if they are plain objects, do they have the same shape? * * @param {*} a * @param {*} b * @return {Boolean} */ function looseEqual(a, b) { /* eslint-disable eqeqeq */ return a == b || (isObject(a) && isObject(b) ? JSON.stringify(a) === JSON.stringify(b) : false); /* eslint-enable eqeqeq */ } var hasProto = ('__proto__' in {}); // Browser environment sniffing var inBrowser = typeof window !== 'undefined' && Object.prototype.toString.call(window) !== '[object Object]'; // detect devtools var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; // UA sniffing for working around browser-specific quirks var UA = inBrowser && window.navigator.userAgent.toLowerCase(); var isIE9 = UA && UA.indexOf('msie 9.0') > 0; var isAndroid = UA && UA.indexOf('android') > 0; var transitionProp = undefined; var transitionEndEvent = undefined; var animationProp = undefined; var animationEndEvent = undefined; // Transition property/event sniffing if (inBrowser && !isIE9) { var isWebkitTrans = window.ontransitionend === undefined && window.onwebkittransitionend !== undefined; var isWebkitAnim = window.onanimationend === undefined && window.onwebkitanimationend !== undefined; transitionProp = isWebkitTrans ? 'WebkitTransition' : 'transition'; transitionEndEvent = isWebkitTrans ? 'webkitTransitionEnd' : 'transitionend'; animationProp = isWebkitAnim ? 'WebkitAnimation' : 'animation'; animationEndEvent = isWebkitAnim ? 'webkitAnimationEnd' : 'animationend'; } /** * Defer a task to execute it asynchronously. Ideally this * should be executed as a microtask, so we leverage * MutationObserver if it's available, and fallback to * setTimeout(0). * * @param {Function} cb * @param {Object} ctx */ var nextTick = (function () { var callbacks = []; var pending = false; var timerFunc; function nextTickHandler() { pending = false; var copies = callbacks.slice(0); callbacks = []; for (var i = 0; i < copies.length; i++) { copies[i](); } } /* istanbul ignore if */ if (typeof MutationObserver !== 'undefined') { var counter = 1; var observer = new MutationObserver(nextTickHandler); var textNode = document.createTextNode(counter); observer.observe(textNode, { characterData: true }); timerFunc = function () { counter = (counter + 1) % 2; textNode.data = counter; }; } else { // webpack attempts to inject a shim for setImmediate // if it is used as a global, so we have to work around that to // avoid bundling unnecessary code. var context = inBrowser ? window : typeof global !== 'undefined' ? global : {}; timerFunc = context.setImmediate || setTimeout; } return function (cb, ctx) { var func = ctx ? function () { cb.call(ctx); } : cb; callbacks.push(func); if (pending) return; pending = true; timerFunc(nextTickHandler, 0); }; })(); function Cache(limit) { this.size = 0; this.limit = limit; this.head = this.tail = undefined; this._keymap = Object.create(null); } var p = Cache.prototype; /** * Put