Skip to content

Commit

Permalink
fix: improvements to make it work with Nuxt content
Browse files Browse the repository at this point in the history
  • Loading branch information
Atinux committed Oct 2, 2020
1 parent c1c8de2 commit 46cc0e2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function imageModule (moduleOptions: ModuleOptions) {
// Apply local defaults
if (options.providers.local && typeof options.providers.local === 'object') {
options.providers.local = {
dir: path.join(nuxt.options.srcDir, 'static'),
dir: path.resolve(nuxt.options.srcDir, nuxt.options.dir.static),
...options.providers.local
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function createImage (context, { providers, defaultProvider, presets }: C
}

if (!provider) {
throw new Error('Unsupported provided ' + options.provider)
throw new Error('Unsupported provider ' + options.provider)
}

if (preset && !presetMap[preset]) {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/nuxt-image-mixins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ export default {
required: true
},
width: {
type: String,
type: [String, Number],
default: ''
},
height: {
type: String,
type: [String, Number],
default: ''
},
legacy: {
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/nuxt-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ export default {
const placeholder = h('div', {
class: '__nim_pl',
style: {
paddingBottom: this.height ? `${this.height}` : undefined
paddingBottom: this.height ? `${parseInt(this.height, 10)}px` : undefined
}
})

const wrapper = h('div', {
style: {
width: this.width ? this.width : undefined
width: this.width ? `${parseInt(this.width, 10)}px` : undefined
},
class: ['__nim_w', this.loaded ? 'visible' : '']
class: ['__nim_w', this.loaded ? 'visible' : ''].concat(this.$attrs.class || '')
}, [bluryImage, originalImage, noScript, placeholder])

return wrapper
Expand Down

0 comments on commit 46cc0e2

Please sign in to comment.