0
所以在我nuxt.js項目,我需要在此描述https://nuxtjs.org/examples/custom-routesnuxt.js - >自定義路線不愛可信如何獲得「身份證」
我迄今implmented是下面的自定義路線。
文件:網頁\ trails.vue
...
<nuxt-link v-bind:to="'/trail/' + trail.article_code">{{ trail.article_description }}</nuxt-link>
...
這將equivelent到index.vue文件。如果我是正確的沒有額外的代碼是在這個文件是有關
文件:\網頁線索\ _id
<template>
<div class="vttTrails">
<div class="ui grid centered">
<div v-for="(trail, index) in listTrail">
<div class="ui card">
{{ trail.article_code }}
</div>
</div>
</div>
</div>
</template>
<script>
import feathers from 'feathers/client';
import socketio from 'feathers-socketio/client';
import hooks from 'feathers-hooks';
import io from 'socket.io-client';
import * as process from "../../nuxt.config";
const vttSocket = io(process.env.backendUrl);
const vttFeathers = feathers()
.configure(socketio(vttSocket))
.configure(hooks());
const serviceArticles = vttFeathers.service('articles');
export default {
layout: 'default',
data: function() {
return {
listTrail: [],
curLanguage: this.$store.state.site.curLanguage,
curCategory: this.$store.state.site.curCategory
}
},
mounted: function() {
return serviceArticles.find({
query: {
category_id: this.$store.state.site.curCategory,
article_code: '',
$sort: {
article_rating: 1
},
$select: [
'id',
['article_description_' + this.$store.state.site.curLanguage, 'article_description'],
'article_length',
'article_ascend',
'article_code',
'article_at',
]
}
}).then(page => {
this.listTrail = page.data;
})
},
}
</script>
所以在這裏,我把整個文件,以防萬一。點擊鏈接將轉到例如「trail \ cwu」這是正確的,因爲我有這個。值「cwu」需要進入article_code: ''
。我試圖做mounted: function(params)
但它不起作用。
問題
什麼我需要做我的「_id.vue」,讓「PARAMS」的一部分?最終我會調整選擇,因爲它只會返回一個選項。