2020-05-26 15:59:11 +08:00
|
|
|
<template>
|
|
|
|
<div class="option">
|
2020-10-20 16:48:28 +08:00
|
|
|
<template v-if="type=='select' || type=='multi'">
|
2020-05-26 15:59:11 +08:00
|
|
|
<div v-for="(el,i) in optionList" :key="i" class="option__item">
|
|
|
|
<div> 选项-{{ $asc2chart(65+i) }} </div>
|
|
|
|
<item-rich v-model="el.content" :remove="remove" @modify="doModify(el)" @remove="doRemove(i)" />
|
|
|
|
</div>
|
|
|
|
<el-button v-if="add" class="item__button" type="primary" size="mini" icon="el-icon-plus" @click="doAppend" />
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import ItemRich from './item-rich';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
ItemRich
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
optionList: {
|
|
|
|
type: Array,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
add: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
remove: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
doModify(el) {
|
|
|
|
this.$emit('modify', {model: el, prop: 'content'});
|
|
|
|
},
|
|
|
|
doRemove(index) {
|
|
|
|
this.$emit('remove', index);
|
|
|
|
},
|
|
|
|
doAppend() {
|
|
|
|
this.$emit('append');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.option {
|
|
|
|
&__item {
|
|
|
|
margin-bottom: 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|