nuxt-uid-module
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.2.0"></a> | ||
# [0.2.0](https://github.com/mya-ake/nuxt-uid-module/compare/v0.1.0...v0.2.0) (2018-11-25) | ||
### Features | ||
* Update for vue-uid mixin ([#2](https://github.com/mya-ake/nuxt-uid-module/issues/2)) ([67085ba](https://github.com/mya-ake/nuxt-uid-module/commit/67085ba)), closes [#1](https://github.com/mya-ake/nuxt-uid-module/issues/1) [#1](https://github.com/mya-ake/nuxt-uid-module/issues/1) | ||
<a name="0.1.0"></a> | ||
@@ -7,0 +17,0 @@ # 0.1.0 (2018-11-16) |
{ | ||
"name": "nuxt-uid-module", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Unique ID for Vue.js component with Nuxt.js.", | ||
@@ -14,3 +14,7 @@ "main": "src/module.js", | ||
"lint": "vue-cli-service lint", | ||
"test:integration": "jest --config tests/integration/jest.config.js", | ||
"test:integration": "run-s test:integration:* test:integration:mixin:*", | ||
"test:integration:default": "jest --config tests/integration/jest.config.js", | ||
"test:integration:name": "TEST_NAME=true yarn test:integration:default", | ||
"test:integration:mixin:default": "TEST_MIXIN=true yarn test:integration:default", | ||
"test:integration:mixin:name": "TEST_MIXIN=true TEST_NAME=true yarn test:integration:default", | ||
"nuxt:build": "nuxt build tests/fixtures/nuxt", | ||
@@ -22,3 +26,3 @@ "nuxt:start": "nuxt start tests/fixtures/nuxt", | ||
"dependencies": { | ||
"vue-uid": "^0.3.0" | ||
"vue-uid": "^0.4.0" | ||
}, | ||
@@ -32,2 +36,3 @@ "devDependencies": { | ||
"babel-jest": "^23.6.0", | ||
"consola": "^2.3.0", | ||
"eslint": "^5.9.0", | ||
@@ -34,0 +39,0 @@ "eslint-plugin-vue": "^4.7.1", |
@@ -21,5 +21,5 @@ # nuxt-uid-module | ||
// options (See https://github.com/mya-ake/vue-uid#option) | ||
'uid-module': { | ||
name: 'uid' | ||
name: 'uid' // property name(option) | ||
plugin: false, // when to use vue-uid mixin(option) | ||
}, | ||
@@ -35,2 +35,16 @@ }; | ||
[vue-uid Options](https://github.com/mya-ake/vue-uid#option) | ||
### vue-uid options | ||
See [vue-uid Options](https://github.com/mya-ake/vue-uid#option). | ||
- `name` (option) | ||
### nuxt-uid-module options | ||
#### `plugin` (option) | ||
- type: `boolean` | ||
- default: `true` | ||
Set to false when using [vue-uid mixin](https://github.com/mya-ake/vue-uid#mixin). | ||
If false, vue-uid plugins will not be registered. |
import path from 'path'; | ||
const defaultOptions = { | ||
plugin: true, | ||
}; | ||
export default function nuxtUidModule(_moduleOption) { | ||
const moduleOption = { | ||
...defaultOptions, | ||
...this.options['uid-module'], | ||
@@ -9,7 +14,21 @@ ..._moduleOption, | ||
const options = {}; | ||
// use plugin option | ||
if (moduleOption.plugin) { | ||
options.usePlugin = true; | ||
} | ||
// use name option | ||
if (typeof moduleOption.name === 'string') { | ||
options.name = moduleOption.name; | ||
} | ||
delete moduleOption.plugin; | ||
options.plugin = JSON.stringify(moduleOption); | ||
this.addPlugin({ | ||
src: path.resolve(__dirname, 'plugin.template.js'), | ||
ssr: true, | ||
options: JSON.stringify(moduleOption), | ||
options, | ||
}); | ||
} |
import Vue from 'vue'; | ||
import VueUid, { uid } from 'vue-uid'; | ||
Vue.use(VueUid, { | ||
...JSON.parse('<%= options %>'), | ||
<% if (options.usePlugin) { %> | ||
Vue.use(VueUid, { | ||
...JSON.parse('<%= options.plugin %>'), | ||
}); | ||
<% } else if (options.name) { %> | ||
uid.setName('<%= options.name %>') | ||
<% } %> | ||
export default () => { | ||
uid.reset(); | ||
}; |
5187
39
49
15
+ Addedvue-uid@0.4.5(transitive)
- Removedvue-uid@0.3.2(transitive)
Updatedvue-uid@^0.4.0