Skip to content

Commit 6b10d13

Browse files
author
Pooya Parsa
committed
feat: allow passing arbitrary options to framework7
1 parent dbe7b2e commit 6b10d13

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

Diff for: examples/kitchen-sink/nuxt.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
framework7: {
1919
themeColor: '#2196f3',
2020
mode: 'history',
21+
foo: 'bar',
2122
routes: {
2223
'tabs-routable': {
2324
tabs: [

Diff for: lib/module.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { resolve, relative } = require('path')
2-
const { defaultsDeep } = require('lodash')
2+
const { defaultsDeep, omit } = require('lodash')
33
const f7BuildConfig = require('./f7-config')
44

55
const resolvePath = (...args) => resolve(__dirname, ...args)
@@ -84,7 +84,7 @@ function addTemplates (options) {
8484
this.addPlugin({
8585
src: resolvePath('templates/f7-plugin.js'),
8686
fileName: 'f7-plugin.js',
87-
options
87+
options: omit(options, extraKeys)
8888
})
8989

9090
// Framework7 routes
@@ -156,20 +156,20 @@ function extendConfig (config, options) {
156156
// ----------------------------------------------------------
157157
// Default options
158158
// ----------------------------------------------------------
159+
const extraKeys = [
160+
'build', 'mode', 'themeColor', 'css', 'f7Icons', 'mdIcons', 'f7IconsSrc', 'mdIconsSrc', 'pwa'
161+
]
162+
159163
const defaults = {
160164
build: Object.assign({}, f7BuildConfig),
161165

162166
mode: 'hash',
163-
164167
css: true,
165-
166168
f7Icons: true,
167169
mdIcons: true,
168170

169171
routes: {},
170-
statusbar: {},
171172

172-
touch: {},
173173
view: {
174174
main: true,
175175
pushState: true,

Diff for: lib/templates/f7-plugin.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ Vue.use(Framework7VueComponents)
1212

1313
// Register plugin
1414
export default async function framework7({ app }, inject) {
15-
// Register F7 Vue Plugin
16-
const Framework7 = await _Framework7
17-
Vue.use(Framework7Vue, Framework7)
15+
// Register F7 Vue Plugin
16+
const Framework7 = await _Framework7
17+
Vue.use(Framework7Vue, Framework7)
1818

19-
// Framework7 options
20-
app.framework7 = <%= serialize({
21-
mode: options.mode,
22-
view: options.view,
23-
touch: options.touch
24-
}).replace(/"__([^_]+)__"/g, "$1") %>
19+
// Framework7 options
20+
app.framework7 = <%= serialize(options).replace(/"__([^_]+)__"/g, "$1") %>
2521

26-
// Routes
27-
app.framework7.routes = routes
22+
// Routes
23+
app.framework7.routes = routes
2824
}
2925

0 commit comments

Comments
 (0)