我想使用 vue.js 版本 3 上传文件。
我可以导入ref,但不确定如何使用它来获取文件数据?
文件上传测试.vue
<template>
<h1>File Upload</h1>
<div class="container">
<div>
<label>File
<input type="file" id="file" ref="file" v-on:change="onChangeFileUpload()"/>
</label>
<button v-on:click="submitForm()">Upload</button>
</div>
</div>
</template>
<script src="./FileUploadTest.ts" lang="ts"></script>
Run Code Online (Sandbox Code Playgroud)
文件上传测试.ts
import { Options, Vue } from "vue-class-component";
import { ref } from 'vue';
import axios from "../../axios/index";
@Options({})
export default class FileUploadTest extends Vue {
protected file: any;
submitForm() {
const formData = new FormData();
formData.append('bytes', this.file);
axios.post('https://localhost:44313/api/app/file/save',
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
}
}
).then(function (data) { …Run Code Online (Sandbox Code Playgroud) 我需要创建一个与配置的 CallBackPath 匹配的端点,以使 OpenId 身份验证正常工作。但我不明白它有什么用?
如果有人能解释一下那就太好了?
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = "CookieScheme";
options.DefaultChallengeScheme = "GoogleOpenIDScheme";
}
).AddOpenIdConnect("GoogleOpenIDScheme", options=>
{
options.Authority = "https://XXXXXXXX";
options.ClientId = "XXXXXXXX";
options.ClientSecret = "XXXXXXXXXXXX";
options.CallbackPath = "/Security/AuthOpenId";
}
);
Run Code Online (Sandbox Code Playgroud) 在下面的例子中
const char* msg1 = "hello how are you";
Run Code Online (Sandbox Code Playgroud)
我想复制到 uint8_t msg2[]
如何将 msg1 值复制到 msg2 中?