这就是我想要的:
<!DOCTYPE html>
<html lang="en-gb">
<head>
<title>YouTube Embed</title>
</head>
<body>
<iframe src="https://www.youtube.com/embed/kqEfk801E94" />
</body>
</html>
<template>
<div>
<iframe :src="url" />
</div>
</template>
<script>
export default {
data() {
return {
url: ''
}
},
methods: {
async loadYouTubeUrl() {
const response = await fetch('api/videos/:id/get') // wherever your API is
const json = await response.json()
this.url = json.url // wherever this property is
}
}
}
</script>
和data = {}
a = 'имя'
b = 'фамилия'
data[a] = 'osman'
data[b] = 'omar'
不起作用。如何获得这样的结果?
答案 0 :(得分:2)
如果使用Python2,请将此行放在.py文件的顶部:
# -*- coding: utf-8 -*-
如果您使用的是Python3,您的代码就可以正常工作。