我仍然是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]
非常感谢您的回答。