|
|
@@ -0,0 +1,159 @@
|
|
|
+<template>
|
|
|
+ <div class="editor">
|
|
|
+ <el-input v-model="title" class="title" placeholder="请输入标题"></el-input>
|
|
|
+ <el-input v-model="subTitle" class="sub-title" placeholder="请输入导语(选填)"></el-input>
|
|
|
+ <el-input v-model="content" class="content" placeholder="请输入正文…"></el-input>
|
|
|
+ <h5 class="label">封面图</h5>
|
|
|
+ <el-upload action="#" list-type="picture-card" :auto-upload="false">
|
|
|
+ <i slot="default" class="el-icon-plus"></i>
|
|
|
+ <div slot="file" slot-scope="{file}">
|
|
|
+ <img class="el-upload-list__item-thumbnail" :src="file.url" alt />
|
|
|
+ <span class="el-upload-list__item-actions">
|
|
|
+ <span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
|
|
|
+ <i class="el-icon-zoom-in"></i>
|
|
|
+ </span>
|
|
|
+ <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleDownload(file)">
|
|
|
+ <i class="el-icon-download"></i>
|
|
|
+ </span>
|
|
|
+ <span v-if="!disabled" class="el-upload-list__item-delete" @click="handleRemove(file)">
|
|
|
+ <i class="el-icon-delete"></i>
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ <el-dialog :visible.sync="dialogVisible">
|
|
|
+ <img width="100%" :src="dialogImageUrl" alt />
|
|
|
+ </el-dialog>
|
|
|
+ <h5 class="label">选择分类</h5>
|
|
|
+ <el-select v-model="value" placeholder="请选择">
|
|
|
+ <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ <h5 class="label">标签</h5>
|
|
|
+ <el-select
|
|
|
+ v-model="tags"
|
|
|
+ multiple
|
|
|
+ filterable
|
|
|
+ allow-create
|
|
|
+ default-first-option
|
|
|
+ placeholder="请选择文章标签"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in tagOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ <footer>
|
|
|
+ <el-button type="primary">发布</el-button>
|
|
|
+ <el-button>取消</el-button>
|
|
|
+ </footer>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ // props: ['locations'],
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ title: '',
|
|
|
+ subTitle: '',
|
|
|
+ content: '',
|
|
|
+ dialogImageUrl: '',
|
|
|
+ dialogVisible: false,
|
|
|
+ disabled: false,
|
|
|
+ options: [{
|
|
|
+ value: '选项1',
|
|
|
+ label: '黄金糕'
|
|
|
+ }, {
|
|
|
+ value: '选项2',
|
|
|
+ label: '双皮奶'
|
|
|
+ }, {
|
|
|
+ value: '选项3',
|
|
|
+ label: '蚵仔煎'
|
|
|
+ }, {
|
|
|
+ value: '选项4',
|
|
|
+ label: '龙须面'
|
|
|
+ }, {
|
|
|
+ value: '选项5',
|
|
|
+ label: '北京烤鸭'
|
|
|
+ }],
|
|
|
+ value: '',
|
|
|
+ tagOptions: [{
|
|
|
+ value: 'HTML',
|
|
|
+ label: 'HTML'
|
|
|
+ }, {
|
|
|
+ value: 'CSS',
|
|
|
+ label: 'CSS'
|
|
|
+ }, {
|
|
|
+ value: 'JavaScript',
|
|
|
+ label: 'JavaScript'
|
|
|
+ }],
|
|
|
+ tags: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleRemove(file) {
|
|
|
+ console.log(file);
|
|
|
+ },
|
|
|
+ handlePictureCardPreview(file) {
|
|
|
+ this.dialogImageUrl = file.url;
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ handleDownload(file) {
|
|
|
+ console.log(file);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.editor {
|
|
|
+ position: relative;
|
|
|
+ padding: 20px;
|
|
|
+ width: 740px;
|
|
|
+ background: #fff;
|
|
|
+ .title,
|
|
|
+ .sub-title {
|
|
|
+ .el-input__inner {
|
|
|
+ padding: 0;
|
|
|
+ border: 0;
|
|
|
+ border-radius: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .title {
|
|
|
+ margin: 10px auto 20px;
|
|
|
+ font-size: 28px;
|
|
|
+ font-family: PingFangSC-Medium;
|
|
|
+ font-weight: 500;
|
|
|
+ color: rgba(29, 42, 58, 1);
|
|
|
+ line-height: 40px;
|
|
|
+ }
|
|
|
+ .sub-title {
|
|
|
+ margin-bottom: 28px;
|
|
|
+ height: 18px;
|
|
|
+ font-size: 13px;
|
|
|
+ font-family: PingFangSC-Regular;
|
|
|
+ font-weight: 400;
|
|
|
+ color: rgba(145, 154, 167, 1);
|
|
|
+ line-height: 18px;
|
|
|
+ border-left: 2px solid #0093fd;
|
|
|
+ .el-input__inner {
|
|
|
+ height: 18px;
|
|
|
+ line-height: 18px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .label {
|
|
|
+ margin: 20px auto 10px;
|
|
|
+ font-size: 13px;
|
|
|
+ font-family: PingFangSC-Medium;
|
|
|
+ font-weight: 500;
|
|
|
+ color: rgba(25, 34, 46, 1);
|
|
|
+ line-height: 18px;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|