Skip to content

Commit

Permalink
fix: provide is inside setup.
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Mar 12, 2022
1 parent 3dfb041 commit d1f1310
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
9 changes: 6 additions & 3 deletions packages/pro-layout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ant-design-vue/pro-layout",
"version": "3.2.0-alpha.1",
"version": "3.2.0-alpha.2",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
Expand All @@ -13,14 +13,17 @@
"files": [
"dist"
],
"types": "./dist",
"style": "./dist/style.css",
"main": "./dist/pro-layout.umd.js",
"module": "./dist/pro-layout.es.js",
"typings": "./dist/main.d.ts",
"exports": {
".": {
"import": "./dist/pro-layout.es.js",
"require": "./dist/pro-layout.umd.js"
}
},
"./dist/style.css": "./dist/style.css",
"./dist/style.less": "./dist/style.less"
},
"dependencies": {
"@ant-design/icons-vue": "^6.0.1",
Expand Down
9 changes: 6 additions & 3 deletions packages/pro-layout/src/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import {
unref,
defineComponent,
toRefs,
provide,
type App,
type Plugin,
type CSSProperties,
type PropType,
type ExtractPropTypes,
type DefineComponent,
} from 'vue'

import 'ant-design-vue/es/layout/style'
import { Layout } from 'ant-design-vue'
import useMediaQuery from './hooks/useMediaQuery'

import { defaultSettingProps } from './defaultSettings'
import { provideRouteContext, defaultRouteContext, type RouteContextProps } from './RouteContext'
import { routeContextInjectKey, defaultRouteContext, type RouteContextProps } from './RouteContext'
import SiderMenuWrapper, { siderMenuProps } from './components/SiderMenu'
import { WrapContent } from './WrapContent'
import { HeaderView as Header, headerViewProps } from './Header'
Expand Down Expand Up @@ -232,7 +235,7 @@ const ProLayout = defineComponent({
hasSide,
flatMenu: hasFlatMenu,
})
provideRouteContext(routeContext)
provide(routeContextInjectKey, routeContext)

return () => {
const {
Expand Down Expand Up @@ -329,4 +332,4 @@ ProLayout.install = (app: App) => {
return app
}

export default ProLayout
export default ProLayout as DefineComponent<BasicLayoutProps> & Plugin
2 changes: 1 addition & 1 deletion packages/pro-layout/src/RouteContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const defaultRouteContext = reactive({
hasFooterToolbar: false,
})

const routeContextInjectKey: InjectionKey<RouteContextProps> = Symbol('route-context')
export const routeContextInjectKey: InjectionKey<RouteContextProps> = Symbol('route-context')

export const createRouteContext = () => createContext<RouteContextProps>(routeContextInjectKey, 'RouteContext.Provider')

Expand Down
2 changes: 1 addition & 1 deletion packages/pro-layout/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './default.less'
import './index.less'
import './style.less'

export * from './RouteContext'
export * from './typings'
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion packages/pro-layout/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"composite": true,
"paths": {
"@/*": ["./src/*"],
"@ant-design-vue/pro-layout":["./src/index.ts"]
"@ant-design-vue/pro-layout":["./src/index.ts"],
"vue-types": ["../../node_modules/vue-types"],
}
}
}

0 comments on commit d1f1310

Please sign in to comment.