File tree 3 files changed +36
-0
lines changed
packages/@vuepress/core/lib
internal-plugins/dataBlock
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ module . exports = ( ) => ( {
2
+ name : '@vuepress/internal-data-block' ,
3
+
4
+ chainWebpack ( config ) {
5
+ config
6
+ . module
7
+ . rule ( 'data-block' )
8
+ . resourceQuery ( / b l o c k T y p e = d a t a / )
9
+ . use ( 'date-block-loader' )
10
+ . loader ( require . resolve ( './loader.js' ) )
11
+ } ,
12
+
13
+ enhanceAppFiles ( ) {
14
+ return [ {
15
+ name : 'data-block' ,
16
+ content : `
17
+ export default ({ Vue }) => { Vue.mixin({
18
+ computed: {
19
+ $dataBlock() {
20
+ return this.$options.__data__block__
21
+ }
22
+ }
23
+ }) }` . trim ( )
24
+ } ]
25
+ }
26
+ } )
Original file line number Diff line number Diff line change
1
+ module . exports = function ( source , map ) {
2
+ this . callback (
3
+ null ,
4
+ `export default function (Component) {
5
+ Component.options.__data__block__ = ${ source . trim ( ) }
6
+ }` ,
7
+ map
8
+ )
9
+ }
Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ module.exports = class AppContext {
115
115
. use ( require ( '../internal-plugins/layoutComponents' ) )
116
116
. use ( require ( '../internal-plugins/pageComponents' ) )
117
117
. use ( require ( '../internal-plugins/transformModule' ) )
118
+ . use ( require ( '../internal-plugins/dataBlock' ) )
118
119
// user plugin
119
120
. useByPluginsConfig ( this . cliOptions . plugins )
120
121
. useByPluginsConfig ( this . siteConfig . plugins )
You can’t perform that action at this time.
0 commit comments