【发布时间】:2019-03-27 16:45:09
【问题描述】:
我还是 Vue.js 的初学者,但我遇到了问题。我有这个代码:
data: function(){
return {
search: '',
zenes: [
{ id: '1', name: 'Jhon Snow', profile_pic: 'https://i.stack.imgur.com/CE5lz.png'},
{ id: '2', name: 'Deanerys Targarian', profile_pic: 'https://i.stack.imgur.com/CE5lz.png'},
{ id: '3', name: 'Jaime Lanister', profile_pic: 'https://i.stack.imgur.com/CE5lz.png'},
{ id: '4', name: 'Tyron Lanister', profile_pic: 'https://i.stack.imgur.com/CE5lz.png'}
]};
},
这段代码非常好,但我想在我的应用程序中使用,所以我想将 zenes:[....] 更改为外部 javascript 代码:
<script>var zenecim = <%- zenecim %></script>//these are big arrays thousands of items
<script>var zenesrc = <%- zenesrc %></script>
我希望看到这样或那样的东西:
zenes:[id:(this is the indexof the array),name:zenecim,src:zenesrc]
非常感谢您的回答。
【问题讨论】:
标签: javascript arrays vue.js