This commit is contained in:
@fawn-nine
2023-06-26 10:21:58 +08:00
parent 8e7a0ac397
commit 43a14b2f21

View File

@@ -22,14 +22,14 @@
</el-form-item>
<el-form-item label="协议内容" prop="content">
<quill-editor v-model="dataForm.content" ref="myQuillEditor" :options="editorOption"
@blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
@blur="onEditorBlur($event)" @focus="onEditorFocus($event)"
@ready="onEditorReady($event)" class="shangpin_editor">
</quill-editor>
</quill-editor>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handlereset">取消</el-button>
<el-button @click="handlereset">取消</el-button>
<el-button type="primary" @click="subMit"> </el-button>
</span>
</el-dialog>
@@ -49,34 +49,43 @@
// visible: {
// type: Boolean,
// value: false
// },
// },
// details: {
// type: Object,
// value: {}
// },
// },
},
data () {
return {
visible:false,
return {
visible:false,
dataForm:{
content:'',
title:'',
id: 0,
type:''
},
},
dataRule: {
title: [{
required: true,
message: '请填写标题',
trigger: 'blur'
}],},
}],},
options: [{
value: 'member',
label: '会员协议'
}, {
value: 'pay',
label: '充值协议'
}],
},
{
value: 'user',
label: '用户协议'
},
{
value: 'privacy',
label: '隐私协议'
}
],
editorOption: {
modules: {
toolbar: [
@@ -131,16 +140,16 @@
init(row){
this.dataForm = row
this.visible = true
},
handlereset() {
},
handlereset() {
this.visible = false
this.$refs['dataForm'].resetFields()
this.$emit('refreshDataList')
this.$refs['dataForm'].resetFields()
this.$emit('refreshDataList')
// this.$refs['dataForm'].reset()
},
},
subMit(){
// 表单提交
this.$refs['dataForm'].validate((valid) => {
// 表单提交
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/agreement/${!this.dataForm.id ? 'save' : 'update'}`),
@@ -149,7 +158,7 @@
'id': this.dataForm.id || undefined,
'title': this.dataForm.title,
'content': this.dataForm.content,
'type': this.dataForm.type
'type': this.dataForm.type
})
}).then(({ data }) => {
if (data && data.code === 0) {
@@ -171,7 +180,7 @@
})
}
})
},
handleClose(){
this.$emit("Close", false)
@@ -180,7 +189,7 @@
},
// 失去焦点事件
onEditorBlur(quill) {
console.log('editor blur!', quill)
console.log('editor blur!', quill)
},
// 获得焦点事件
onEditorFocus(quill) {
@@ -190,10 +199,10 @@
onEditorReady(quill) {
// console.log('editor ready!', quill)
},
},components:{
quillEditor
}
}
</script>
</script>