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
| <template>
| <el-table :data="currentValue" border>
| <el-table-column
| label="参数名称"
| prop="name"
| width="120px"
| ></el-table-column>
| <el-table-column label="参数名称">
| <template #default="{ row }">
| <div v-if="disabled">{{ row.value }}</div>
| <el-input v-else v-model="row.value" @change="onInputChange"></el-input>
| </template>
| </el-table-column>
| </el-table>
| </template>
|
| <script>
| export default {
| props: {
| value: {
| type: Array,
| default: () => [],
| },
| disabled: {
| type: Boolean,
| default: false,
| },
| },
| data() {
| return {
| currentValue: [],
| }
| },
| watch: {
| value: {
| immediate: true,
| handler(value) {
| this.currentValue = (value || []).map((item) => {
| if (!item.value) {
| item.value = (item.values || []).join(',')
| }
| return item
| })
| },
| },
| },
| methods: {
| onInputChange() {
| this.$emit('input', this.currentValue)
| this.$emit('change', this.currentValue)
| },
| },
| }
| </script>
|
| <style lang="scss" scoped>
| .goods-params {
| }
| </style>
|
|