Allows .vue files to be used in package modules as if they were .js files: they can be added to the 'packageFiles' array in module definitions, and require()d from JS files. In the load.php output, each .vue file is transformed to a function that contains the JS from the <script> tag, then a line that sets module.exports.template to the contents of the <template> tag (encoded as a string). The contents of the <style> tag are added to the module's styles. Internally, the type of a .vue file is inferred as 'script-vue', and the file is parsed with VueComponentParser, which extracts the three parts. After the transformation, the file's type is set to 'script+style', and files of this type contribute to both getScript() and getStyles(). This change also adds caching to getPackageFiles(), because it now needs to be called twice (in getScript() and getStyles()). Change-Id: Ic0a5c771901450a518eb7d24456053956507e1ed
8 lines
230 B
Text
8 lines
230 B
Text
module.exports = {
|
|
data: function () {
|
|
return {
|
|
hello: 'world'
|
|
};
|
|
}
|
|
};;
|
|
module.exports.template = "<div class=\"mw-vue-test\">\n<p>Hello\\n<\/p>\n<p>{{ hello }}<\/p>\n<pre>\n\t\t\tfoo\\\n\t\t\tbar\n\t\t<\/pre>\n<\/div>";
|