Skip to content

Commit

Permalink
fix: ssr route detection
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Mar 7, 2024
1 parent 53e0489 commit 69a4e3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/runtime/components/MDCRenderer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default defineComponent({
},
async setup (props) {
const $nuxt = getCurrentInstance()?.appContext?.app?.$nuxt
const route = $nuxt?.$route
const route = $nuxt?.$route || $nuxt?._route
const { mdc } = $nuxt?.$config?.public || {}
const tags = {
Expand Down Expand Up @@ -151,14 +151,14 @@ function renderBinding (node: MDCElement, h: CreateElement, documentMeta: MDCDat
const splitter = /\.|\[(\d+)\]/
const keys: string[] = node.props?.value.trim().split(splitter).filter(Boolean)
const value = keys.reduce((data, key) => {
if (key in data) {
if (data && key in data) {
if (typeof data[key] === 'function') {
return data[key]()
} else {
return data[key]
}
}
return {}
return undefined
}, data)
const defaultValue = node.props?.defaultValue
Expand Down

0 comments on commit 69a4e3d

Please sign in to comment.