Skip to content

Commit afd8f4f

Browse files
committed
fix!: useCSSModule renamed to useCssModule to align with Vue 3, close #626
`useCSSModule` is depreacted.
1 parent 5774b9f commit afd8f4f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/apis/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export * from './lifecycle'
2828
export * from './watch'
2929
export * from './computed'
3030
export * from './inject'
31-
export { useCSSModule } from './useCssModule'
31+
export { useCssModule, useCSSModule } from './useCssModule'
3232
export { createApp } from './createApp'
3333
export { nextTick } from './nextTick'
3434
export { createElement as h } from './createElement'

src/apis/useCssModule.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ const EMPTY_OBJ: { readonly [key: string]: string } = __DEV__
55
? Object.freeze({})
66
: {}
77

8-
export const useCSSModule = (name = '$style'): Record<string, string> => {
8+
export const useCssModule = (name = '$style'): Record<string, string> => {
99
const instance = getCurrentInstance()
1010
if (!instance) {
11-
__DEV__ && warn(`useCSSModule must be called inside setup()`)
11+
__DEV__ && warn(`useCssModule must be called inside setup()`)
1212
return EMPTY_OBJ
1313
}
1414

@@ -21,3 +21,8 @@ export const useCSSModule = (name = '$style'): Record<string, string> => {
2121

2222
return mod as Record<string, string>
2323
}
24+
25+
/**
26+
* @deprecated use `useCssModule` instead.
27+
*/
28+
export const useCSSModule = useCssModule

test/apis/useCssModule.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Vue = require('vue/dist/vue.common.js')
2-
const { useCSSModule } = require('../../src')
2+
const { useCssModule } = require('../../src')
33

44
const style = { whateverStyle: 'whateverStyle' }
55

@@ -20,7 +20,7 @@ describe('api/useCssModule', () => {
2020
},
2121
template: '<div>{{style}}</div>',
2222
setup() {
23-
const style = useCSSModule()
23+
const style = useCssModule()
2424
return { style }
2525
},
2626
})

0 commit comments

Comments
 (0)