admin管理员组文章数量:1418057
Here is a similar example of table that I have in my project.
My project is a multilingual website so I would like to have vue-table also translated to the language user currently uses. What I want to be translated is only the table elements not the actual data inside the table. For instance in the example string 'records' should be translated to the users language. Also text 'Showing 1 to 10 of 50 records' under the pagination should be translated.
.
Example code:
Vue.use(VueTables.ClientTable);
new Vue({
el: "#app",
data: {
columns: ['name', 'code', 'uri'],
data: getData(),
options: {
headings: {
name: 'Country Name',
code: 'Country Code',
uri: 'View Record'
},
sortable: ['name', 'code'],
filterable: ['name', 'code']
}
}
});
And HTML:
<div id="app">
<v-client-table :columns="columns" :data="data" :options="options">
<a slot="uri" slot-scope="props" target="_blank" :href="props.row.uri" class="glyphicon glyphicon-eye-open"></a>
<div slot="child_row" slot-scope="props">
The link to {{props.row.name}} is <a :href="props.row.uri">{{props.row.uri}}</a>
</div>
</v-client-table>
</div>
If anyone have any clue how I should do this I would be grateful.
Here is a similar example of table that I have in my project.
My project is a multilingual website so I would like to have vue-table also translated to the language user currently uses. What I want to be translated is only the table elements not the actual data inside the table. For instance in the example string 'records' should be translated to the users language. Also text 'Showing 1 to 10 of 50 records' under the pagination should be translated.
.
Example code:
Vue.use(VueTables.ClientTable);
new Vue({
el: "#app",
data: {
columns: ['name', 'code', 'uri'],
data: getData(),
options: {
headings: {
name: 'Country Name',
code: 'Country Code',
uri: 'View Record'
},
sortable: ['name', 'code'],
filterable: ['name', 'code']
}
}
});
And HTML:
<div id="app">
<v-client-table :columns="columns" :data="data" :options="options">
<a slot="uri" slot-scope="props" target="_blank" :href="props.row.uri" class="glyphicon glyphicon-eye-open"></a>
<div slot="child_row" slot-scope="props">
The link to {{props.row.name}} is <a :href="props.row.uri">{{props.row.uri}}</a>
</div>
</v-client-table>
</div>
If anyone have any clue how I should do this I would be grateful.
Share Improve this question asked Jun 20, 2018 at 7:59 NahkaNahka 4261 gold badge6 silver badges16 bronze badges 1- If you need anything else, you can lookup in the plugin repository: github./matfish2/vue-tables-2 – All Pereira Commented Nov 19, 2019 at 12:51
1 Answer
Reset to default 8In the documentation there is the "texts" option which refers to the "texts" option within this file.
So, in your data, you can simply add the texts
parameter and edit them:
new Vue({
el: "#app",
data: {
columns: ['name', 'code', 'uri'],
data: getData(),
options: {
headings: {
name: 'Country Name',
code: 'Country Code',
uri: 'View Record'
},
sortable: ['name', 'code'],
filterable: ['name', 'code'],
// EDITABLE TEXT OPTIONS:
texts: {
count: "Showing {from} to {to} of {count} records|{count} records|One record",
first: 'First',
last: 'Last',
filter: "Filter:",
filterPlaceholder: "Search query",
limit: "Records:",
page: "Page:",
noResults: "No matching records",
filterBy: "Filter by {column}",
loading: 'Loading...',
defaultOption: 'Select {column}',
columns: 'Columns'
},
}
}
});
本文标签: javascriptAdd localization to vuetables2 tableStack Overflow
版权声明:本文标题:javascript - Add localization to vue-tables2 table - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745251262a2649834.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论