添加了类型文件
This commit is contained in:
parent
975821021d
commit
9237c995b5
20
src/types/index.d.ts
vendored
Normal file
20
src/types/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 只添加了一些必要的参数,并没有写完整,因为剩下的大部分用不到
|
||||
*/
|
||||
|
||||
|
||||
// 图片选择
|
||||
export interface ImgInfo {
|
||||
file: string;
|
||||
}
|
||||
|
||||
// 表单提交的验证
|
||||
export interface FromSend {
|
||||
preventDefault: Function;
|
||||
}
|
||||
|
||||
// 视频文件
|
||||
export interface VideoInfo {
|
||||
type: string;
|
||||
name: string;
|
||||
}
|
@ -53,6 +53,7 @@ import { defineComponent, reactive, Ref, ref } from 'vue';
|
||||
import { PlaySquareOutlined, PlusOutlined } from '@ant-design/icons-vue';
|
||||
import NavBottom from '@/components/NavBottom.vue';
|
||||
import { previewCover } from '@/static/js/common';
|
||||
import { ImgInfo } from '@/types';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ReleaseWebcast',
|
||||
@ -81,7 +82,7 @@ export default defineComponent({
|
||||
/**
|
||||
* 封面改变触发事件
|
||||
*/
|
||||
function coverChange(info: any): void {
|
||||
function coverChange(info: ImgInfo): void {
|
||||
// console.log(info);
|
||||
// 获取预览图片
|
||||
previewCover(info.file).then(url => previewImage.value = url);
|
||||
@ -108,7 +109,7 @@ export default defineComponent({
|
||||
/**
|
||||
* 删除封面
|
||||
*/
|
||||
function cancelCover(file: any): void {
|
||||
function cancelCover(file: number): void {
|
||||
console.log(file);
|
||||
|
||||
}
|
||||
@ -117,7 +118,7 @@ export default defineComponent({
|
||||
* @param file 上传的文件
|
||||
*/
|
||||
const beforeVideoUpload = (file: any): boolean => {
|
||||
// console.log(file);
|
||||
console.log(file);
|
||||
if(file.type != '') {
|
||||
// handleRemove(file);
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ import { useForm } from '@ant-design-vue/use';
|
||||
import NavBottom from '@/components/NavBottom.vue';
|
||||
import RankList from './RankList.vue';
|
||||
import { previewCover } from '@/static/js/common';
|
||||
import { FromSend, ImgInfo } from "@/types/index"
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ReleaseWebcast',
|
||||
@ -144,13 +145,14 @@ export default defineComponent({
|
||||
});
|
||||
|
||||
// 是否显示封面预览 封面的路径
|
||||
const viewCover: Ref<boolean> = ref(false),
|
||||
previewImage: Ref<string> = ref('');
|
||||
const viewCover: Ref<boolean> = ref(false);
|
||||
const previewImage: Ref<string> = ref('');
|
||||
|
||||
/**
|
||||
* 封面改变触发事件
|
||||
*/
|
||||
function coverChange(info: any): void {
|
||||
|
||||
function coverChange(info: ImgInfo): void {
|
||||
// console.log(info);
|
||||
// 获取预览图片
|
||||
previewCover(info.file).then(url => previewImage.value = url);
|
||||
@ -162,7 +164,8 @@ export default defineComponent({
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
const onSubmit = (e: any) => {
|
||||
|
||||
const onSubmit = (e: FromSend) => {
|
||||
e.preventDefault();
|
||||
validate().then(() => {
|
||||
console.log(toRaw(form));
|
||||
|
Loading…
Reference in New Issue
Block a user