helpers.ts 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import Vue = require("vue");
  2. import {
  3. mapState,
  4. mapGetters,
  5. mapActions,
  6. mapMutations
  7. } from "../index";
  8. new Vue({
  9. computed: Object.assign({},
  10. mapState(["a"]),
  11. mapState('foo', ["a"]),
  12. mapState({
  13. b: "b"
  14. }),
  15. mapState('foo', {
  16. b: "b"
  17. }),
  18. mapState({
  19. c: (state: any, getters: any) => state.c + getters.c
  20. }),
  21. mapState('foo', {
  22. c: (state: any, getters: any) => state.c + getters.c
  23. }),
  24. mapGetters(["d"]),
  25. mapGetters('foo', ["d"]),
  26. mapGetters({
  27. e: "e"
  28. }),
  29. mapGetters('foo', {
  30. e: "e"
  31. }),
  32. {
  33. otherComputed () {
  34. return "f";
  35. }
  36. }
  37. ),
  38. methods: Object.assign({},
  39. mapActions(["g"]),
  40. mapActions({
  41. h: "h"
  42. }),
  43. mapActions('foo', ["g"]),
  44. mapActions('foo', {
  45. h: "h"
  46. }),
  47. mapMutations(["i"]),
  48. mapMutations({
  49. j: "j"
  50. }),
  51. mapMutations('foo', ["i"]),
  52. mapMutations('foo', {
  53. j: "j"
  54. }),
  55. {
  56. otherMethod () {}
  57. }
  58. )
  59. });