From 175bcf5c3ac42ecf66c519ef9b9673cc0431dc6f Mon Sep 17 00:00:00 2001 From: Bing Sun Date: Sat, 25 Apr 2020 23:16:26 +0800 Subject: [PATCH] add util/with_layout.js --- src/util/with_layout.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/util/with_layout.js diff --git a/src/util/with_layout.js b/src/util/with_layout.js new file mode 100644 index 0000000..2b6c5e3 --- /dev/null +++ b/src/util/with_layout.js @@ -0,0 +1,15 @@ +export default config => { + if (typeof config == 'undefined') + config = {} + + if (!config.hasOwnProperty('content')) + config = {'content': config} + + return { + view: vnode => [ + config.prologue, + m('main', config.content), + config.epilogue + ] + } +}