1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
| <template>
| <div>
| <P>商品详情</P>
| <hr/>
| <el-form-item label="商品轮播图片:" prop="prodImgs">
| <custom-upload-img
| :limitNumber="5"
| :accept='".jpg,.jpeg,.png,.JPG,.JPEG,.PBG,.gif,.GIF,.mp4"'
| @handle-file-data="handleFileData"
| :draggable="true"
| @handle-success="handleSuccess"
| @handle-remove="handleRemove"
| :imageSize="'754 * 754'"
| :fileList="form.prodImgs"
| >
| <template slot="appendPart" slot-scope="item">
| <span class="coverImg" v-show="item.data.index === 0">封面</span>
| </template>
| </custom-upload-img>
| </el-form-item>
| <el-form-item label="商品描述:" prop="productDesc">
| <Editor ref="editor" :content="form.productDesc" @keyup.native="handleKeyup"></Editor>
| </el-form-item>
| </div>
| </template>
|
| <script>
| import Editor from '@/components/editor/editor.vue'
| export default {
| components: { Editor },
| props: {
| form: {
| type: Object,
| default: function () {
| return {}
| }
| }
| },
| methods: {
| // 数组更新时重新获取数据
| handleFileData (arr) {
| this.form.prodImgs = arr
| },
| /**
| * 获取上传成功的图片
| */
| handleSuccess (data) {
| this.form.prodImgs.push({
| url: data.url,
| id: data.id
| })
| },
| /**
| * 移除图片
| */
| handleRemove (file) {
| this.form.prodImgs = this.form.prodImgs.filter(v => {
| return v.id !== file.id
| })
| },
| handleKeyup () {
| this.$emit('product-desc-change', this.$refs.editor.getData())
| }
| }
| }
| </script>
|
| <style lang="scss">
| </style>
|
|