
el毕竟是服务器端的脚本,怎么可能和客户端脚本混用呢?
执行过程是服务器先解析了服务器端脚本后,结果返回到客户端,由浏览器执行返回的结果,这个两个步骤,不能混合搭配使用的。
我觉得有两种做法:
一种是你说的,用字符串,然后客户端拆分再 *** 作。
另一种是用el循环,输出的东西是客户端脚本的数组 *** 作
var aaa=new Array();
<c:forEach items="${reportName}" var="mm">
aaapush("${mm}");
</foreach>
然后 *** 作aaa
两种方法大同小异
data () {
return {
Kanban_img:[],
},
created(){
thisgetImg();
},
methods: {
getImg(){
var _this = this;
var params={
"xxx":xxx,
};
//获取
commonApi(params)
then(res => {
if(resdatareturns[0]length>0){
//方法1
/ var str = "";
resdatareturns[0]forEach(item => {
str += itemkanban_img + ",";
});
str = strsubstring(0, strlength);
_thisKanban_img = strsplit(",");
consolelog(_thisKanban_img) /
//方法2
var aList=resdatareturns[0]
for (let i = 0; i < aListlength; i++) {
if (aList[i]Access != 0) {
_thisKanban_imgpush(baseURL+aList[i]kanban_img)
}
}
}
})
catch(res => {
})
},
}
假设你二维数组。a[][]
$table = $('table');
$each(a,function(i)){
$each(a[i],function(j)){
$tableappend('<tr><td>' + a[i][j] + '</td></tr>')
}
}
以上就是关于javascript 如何通过el表达式获取后台传来的数组全部的内容,包括:javascript 如何通过el表达式获取后台传来的数组、vue从后台获取的数据赋值给全局数组、Jquery从Python后台获取了一个二维数组,如何以表格形式显示在页面等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)