Commit 1da3613 1 parent 5aa075a commit 1da3613 Copy full SHA for 1da3613
File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change 83
83
};
84
84
},
85
85
},
86
- async created () {
86
+ created () {
87
87
if (this .loadExample ) {
88
- await this .loadComponentContent ();
89
- await this .importComponent ();
88
+ this .loadComponentContent ();
89
+ this .importComponent ();
90
90
}
91
91
},
92
92
methods: {
115
115
}
116
116
},
117
117
/*
118
- * Parses the content of the component file into separate code blocks for template, script, and style.
119
- * @param {string} content - The content of the component file
120
- * @returns {Array} An array of code blocks
121
- */
118
+ * Parses the content of the component file into separate code blocks for template, script, and style.
119
+ * @param {string} content - The content of the component file
120
+ * @returns {Array} An array of code blocks
121
+ */
122
122
parseTemplate (content ) {
123
123
const codeBlocks = [];
124
124
125
- const applyRegex = ( target ) => {
125
+ const applyRegex = target => {
126
126
const pattern = new RegExp (` (<${ target} (\\ s[^>]*)?>)([\\ w\\ W]*)(<\\ /${ target} >)` , ' g' );
127
127
const parsed = pattern .exec (content);
128
128
134
134
return parsed[3 ].trim ();
135
135
};
136
136
137
- const template = applyRegex (' template' )
137
+ const template = applyRegex (' template' );
138
138
if (template) {
139
139
codeBlocks .push ({
140
140
language: ' html' ,
141
141
content: template,
142
142
});
143
143
}
144
144
145
- const script = applyRegex (' script' )
145
+ const script = applyRegex (' script' );
146
146
if (script) {
147
147
codeBlocks .push ({
148
148
language: ' javascript' ,
149
149
content: script,
150
150
});
151
151
}
152
152
153
- const style = applyRegex (' style' )
153
+ const style = applyRegex (' style' );
154
154
if (style) {
155
155
codeBlocks .push ({
156
156
language: ' scss' ,
You can’t perform that action at this time.
0 commit comments