|
@ -33,6 +33,7 @@ |
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> |
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
预览 预览预览预览预览 |
|
|
<el-form-item label="HTML:" prop="html"> |
|
|
<el-form-item label="HTML:" prop="html"> |
|
|
<el-input v-model="form.html" type="textarea" placeholder="请输入HTML代码片段"></el-input> |
|
|
<el-input v-model="form.html" type="textarea" placeholder="请输入HTML代码片段"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
@ -94,8 +95,8 @@ import { ElMessage } from 'element-plus'; |
|
|
|
|
|
|
|
|
const formRef = ref(null); |
|
|
const formRef = ref(null); |
|
|
const form = reactive({ |
|
|
const form = reactive({ |
|
|
name: '', |
|
|
name: '测试01', |
|
|
versions: '', |
|
|
versions: 'V1.0.0', |
|
|
intro: '', |
|
|
intro: '', |
|
|
region: '', |
|
|
region: '', |
|
|
sort: '', |
|
|
sort: '', |
|
@ -121,12 +122,6 @@ const rules = { |
|
|
carousel: [{ required: true, message: '请上传轮播图', trigger: 'blur' }], |
|
|
carousel: [{ required: true, message: '请上传轮播图', trigger: 'blur' }], |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
const onSubmit = () => { |
|
|
|
|
|
formRef.value.validate(true); |
|
|
|
|
|
}; |
|
|
|
|
|
const resetForm = () => { |
|
|
|
|
|
formRef.value.resetFields(); |
|
|
|
|
|
}; |
|
|
|
|
|
const options = [ |
|
|
const options = [ |
|
|
{ |
|
|
{ |
|
|
value: 'HTML', |
|
|
value: 'HTML', |
|
@ -142,12 +137,26 @@ const options = [ |
|
|
}, |
|
|
}, |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
function onSubmit() { |
|
|
|
|
|
formRef.value.validate(valid => { |
|
|
|
|
|
console.log('valid: ', valid); |
|
|
|
|
|
if (valid) { |
|
|
|
|
|
console.log('submit!'); |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log('error submit!!'); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
function resetForm() { |
|
|
|
|
|
formRef.value.resetFields(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function handleAvatarSuccess(res, file) { |
|
|
function handleAvatarSuccess(res, file) { |
|
|
form.preview = URL.createObjectURL(file.raw); |
|
|
form.preview = URL.createObjectURL(file.raw); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function beforeAvatarUpload(file) { |
|
|
function beforeAvatarUpload(file) { |
|
|
console.log('file: ', file); |
|
|
|
|
|
const isJPG = file.type === 'image/jpeg'; |
|
|
const isJPG = file.type === 'image/jpeg'; |
|
|
const isLt2M = file.size / 1024 / 1024 < 2; |
|
|
const isLt2M = file.size / 1024 / 1024 < 2; |
|
|
|
|
|
|
|
@ -165,6 +174,7 @@ function handleRemove(file, fileList) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function handlePictureCardPreview(file) { |
|
|
function handlePictureCardPreview(file) { |
|
|
|
|
|
console.log('file: ', file); |
|
|
form.carousel = file.url; |
|
|
form.carousel = file.url; |
|
|
form.dialogVisible = true; |
|
|
form.dialogVisible = true; |
|
|
} |
|
|
} |
|
|