【发布时间】:2020-06-08 02:47:04
【问题描述】:
我正在尝试从
获取 q 参数http://localhost:3000/search?q=myterms
但是,我似乎无法弄清楚为什么它会给我一个错误
无法读取未定义的属性“q”
<template>
<div class="container">
<h1>Hello</h1>
Query: {{ query }}
</div>
</template>
<script>
export default {
watchQuery: ['q'],
name: 'Search',
computed: {
query() {
return this.$route.params.query.q
}
}
}
</script>
<style></style>
任何帮助将不胜感激!谢谢
【问题讨论】:
标签: nuxt.js