Vue.js Dumper (DEPRECATED)

Note

Note that this file is deprecated.

dictdumper.vuejs contains VueJS only, which dumpers a JavaScript file using the Vue.js framework. However, due to errors in grammar, the output file won’t work, thus it is now deprecated. Usage sample is described as below.

>>> dumper = VueJS(file_name)
>>> dumper(content_dict_1, name=content_name_1)
>>> dumper(content_dict_2, name=content_name_2)
............

Deprecated since version 0.8.0.

Dumper class

class dictdumper.vuejs.VueJS(fname, **kwargs)[source]

Bases: JSON

Dump JavaScript file using Vue.js framework.

>>> dumper = VueJS(file_name)
>>> dumper(content_dict_1, name=content_name_1)
>>> dumper(content_dict_2, name=content_name_2)
............
Variables
  • _file (str) – output file name

  • _sptr (int) – indicates start of appending point (file pointer)

  • _tctr (int) – tab level counter

  • _hsrt (str) – _HEADER_START

  • _hend (str) – _HEADER_END

  • _vctr (DefaultDict[int, int]) – value counter dict

__type__ = ((<class 'str'>, 'string'), (<class 'datetime.date'>, 'date'), (<class 'datetime.datetime'>, 'date'), (<class 'datetime.time'>, 'date'), (<class 'bool'>, 'bool'), (<class 'int'>, 'number'), (<class 'float'>, 'number'), (<class 'dict'>, 'object'), (<class 'list'>, 'array'), (<class 'NoneType'>, 'null'))

Type codes.

Type

Tuple[Tuple[type, str]]

Type codes.

Type

Tuple[Tuple[type, str]]

_tctr = 1

Tab level counter.

Type

int

Tab level counter.

Type

int

_hsrt = '// demo data\nvar data = {\n\n'

Vue.js head string.

_hend = "\n\n}\n\n// define the item component\nVue.component('item', {\n  template: '#item-template',\n  props: {\n    model: Object\n  },\n  data: function () {\n    return {\n      open: false\n    }\n  },\n  computed: {\n    isFolder: function () {\n      return this.model.children &&\n        this.model.children.length\n    }\n  },\n  methods: {\n    toggle: function () {\n      if (this.isFolder) {\n        this.open = !this.open\n      }\n    },\n    changeType: function () {\n      if (!this.isFolder) {\n        Vue.set(this.model, 'children', [])\n        this.addChild()\n        this.open = true\n      }\n    },\n    addChild: function () {\n      this.model.children.push({\n        name: 'new stuff'\n      })\n    }\n  }\n})\n\n// boot up the demo\nvar demo = new Vue({\n  el: '#demo',\n  data: {\n    treeData: data\n  }\n})\n"

Vue.js tail string.

_vctr = defaultdict(<class 'int'>, {})

Value counter dict.

Type

DefaultDict[int, int]

property kind

File format of current dumper.

Return type

Literal[‘js’]

Internal utilities

dictdumper.vuejs._HEADER_START = '// demo data\nvar data = {\n\n'

Vue.js head string.

dictdumper.vuejs._HEADER_END = "\n\n}\n\n// define the item component\nVue.component('item', {\n  template: '#item-template',\n  props: {\n    model: Object\n  },\n  data: function () {\n    return {\n      open: false\n    }\n  },\n  computed: {\n    isFolder: function () {\n      return this.model.children &&\n        this.model.children.length\n    }\n  },\n  methods: {\n    toggle: function () {\n      if (this.isFolder) {\n        this.open = !this.open\n      }\n    },\n    changeType: function () {\n      if (!this.isFolder) {\n        Vue.set(this.model, 'children', [])\n        this.addChild()\n        this.open = true\n      }\n    },\n    addChild: function () {\n      this.model.children.push({\n        name: 'new stuff'\n      })\n    }\n  }\n})\n\n// boot up the demo\nvar demo = new Vue({\n  el: '#demo',\n  data: {\n    treeData: data\n  }\n})\n"

Vue.js tail string.