|
4 | 4 |
|
5 | 5 | This package is used to parse vue script section and it provides an interface to add, update and delete entities of different life cycles hooks of VueJS.
|
6 | 6 |
|
| 7 | + |
7 | 8 |
|
8 | 9 | ## Installation
|
| 10 | + |
| 11 | +### [NPM](https://www.npmjs.com/package/vue-script-ast-parser) |
9 | 12 | ```
|
10 | 13 | npm install vue-script-ast-parser
|
11 | 14 | ```
|
@@ -79,21 +82,67 @@ export default {
|
79 | 82 | }
|
80 | 83 | ```
|
81 | 84 |
|
| 85 | + |
| 86 | +## Imports |
| 87 | + |
| 88 | +### To add new import |
| 89 | + |
| 90 | +``` |
| 91 | +let instance = new VueScriptParser(code) |
| 92 | +instace.addImpoort(importStatement) |
| 93 | +``` |
| 94 | + |
| 95 | +### To remove import from imports |
| 96 | + |
| 97 | +``` |
| 98 | +let instance = new VueScriptParser(code) |
| 99 | +instace.removImport(importStatement) |
| 100 | +``` |
| 101 | + |
82 | 102 | ## Data
|
83 | 103 |
|
84 | 104 | ### To add new variable in data
|
85 | 105 |
|
86 | 106 | ```
|
87 | 107 | let instance = new VueScriptParser(code)
|
88 |
| -instace.addData('country','INDIA') |
| 108 | +instace.addData(variableName,value) |
89 | 109 | ```
|
90 | 110 |
|
91 |
| -#### Output |
| 111 | +### To remove variable from data |
92 | 112 |
|
93 | 113 | ```
|
| 114 | +let instance = new VueScriptParser(code) |
| 115 | +instace.removeData(variableName) |
| 116 | +``` |
| 117 | + |
| 118 | +## Mounted |
| 119 | + |
| 120 | +### To add/updated in given script |
94 | 121 |
|
| 122 | +``` |
| 123 | +let instance = new VueScriptParser(code) |
| 124 | +instace.addMounted(mountedBody) |
| 125 | +``` |
| 126 | + |
| 127 | +## Methods |
| 128 | + |
| 129 | +### To add new method in methods |
| 130 | + |
| 131 | +``` |
| 132 | +let instance = new VueScriptParser(code) |
| 133 | +instace.addMethod(name,body,args) |
95 | 134 | ```
|
96 | 135 |
|
| 136 | +### To remove method from methods |
| 137 | + |
| 138 | +``` |
| 139 | +let instance = new VueScriptParser(code) |
| 140 | +instace.removeMethod(methodName) |
| 141 | +``` |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
97 | 146 |
|
98 | 147 |
|
99 | 148 |
|
|
0 commit comments