vue.js 键名 键值 键索引

2021-03-02 15:43:05 浏览数 (2)

代码语言:javascript复制
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title></title>
		<script type="text/javascript" src="./vue.min.js"></script>
	</head>
	<body>
		<div v-for="i in json">{{$key}}=>{{i}}=>{{$index}}</div>
		<script type="text/javascript">
			new Vue(
				{
					el:'body',
					data:{
						arr:['a','b','c'],
						json:{
							leo:'12',
							sky:'22',
							mot:'33'
						}
					}
				}
			);
		</script>
	</body>
</html>

解释:

键名:{{KaTeX parse error: Expected 'EOF', got '}' at position 4: key}̲} 键值:{{i}} 键索引:…index}}

效果:

0 人点赞