代码语言:javascript复制
<input
type="file"
name="upload"
@change="fileChange"
>
代码语言:javascript复制const picture = ref({} as unknown);
const fileChange = (event: Event) => {
const files = (event.target as HTMLInputElement).files; // DOM.files
if (files)
(picture.value as HTMLFrameElement).src = URL.createObjectURL(files[0]);
};