mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-09 20:02:26 +03:00
feat: add deepest resolver (wip)
feat: improve resolver related typing
This commit is contained in:
+16
-1
@@ -22,7 +22,7 @@ app.use(
|
||||
)
|
||||
|
||||
fs.readdirSync(__dirname)
|
||||
.filter(file => file !== 'ssr')
|
||||
.filter(file => file[0] !== '_' && file !== 'ssr')
|
||||
.forEach((file) => {
|
||||
if (fs.statSync(path.join(__dirname, file)).isDirectory()) {
|
||||
app.use(rewrite(`/${file}/*`, `/${file}/index.html`))
|
||||
@@ -32,6 +32,21 @@ fs.readdirSync(__dirname)
|
||||
app.use(express.static(path.join(__dirname, '_static')))
|
||||
app.use(express.static(__dirname))
|
||||
|
||||
app.use((req, res, next) => {
|
||||
// Return empty css/javascript files if the file didnt exists
|
||||
// statically. This means we can test/load any js file in
|
||||
// the examples without errors in the browser
|
||||
if (req.url.endsWith('.js')) {
|
||||
res.setHeader('Content-Type', 'application/javascript')
|
||||
res.send('')
|
||||
next()
|
||||
} else if (req.url.endsWith('.css')) {
|
||||
res.setHeader('Content-Type', 'text/css')
|
||||
res.send('')
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
app.use(async (req, res, next) => {
|
||||
if (!req.url.startsWith('/ssr')) {
|
||||
return next()
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import {
|
||||
createApp,
|
||||
defineComponent,
|
||||
getCurrentInstance,
|
||||
reactive,
|
||||
inject,
|
||||
toRefs,
|
||||
h,
|
||||
watch
|
||||
@@ -20,10 +18,11 @@ const ChildComponent = defineComponent({
|
||||
page: String
|
||||
},
|
||||
template: `
|
||||
<div>
|
||||
<h3>You're looking at the <strong>{{ page }}</strong> page</h3>
|
||||
<p>Has metaInfo been updated due to navigation? {{ metaUpdated }}</p>
|
||||
</div>`,
|
||||
<div>
|
||||
<h3>You're looking at the <strong>{{ page }}</strong> page</h3>
|
||||
<p>Has metaInfo been updated due to navigation? {{ metaUpdated }}</p>
|
||||
</div>
|
||||
`,
|
||||
setup (props) {
|
||||
const state = reactive({
|
||||
date: null,
|
||||
|
||||
Reference in New Issue
Block a user