laravel - 使用summernote时没有保存说明
问题描述
我正在尝试创建一个页面,当您单击创建产品按钮时,会弹出一个模式,然后您输入您喜欢的任何内容。
我使用summernote 作为我的所见即所得编辑器,我也使用vue 作为我的前端。
我遇到的问题是我的描述没有被保存。
在我的 layouts.app 中,我有 Summernote 的 CDN。
这是我的代码
我的 Create.vue
<template>
<transition name="modal-fade">
<div>
<div class="modal-backdrop show"></div>
<div class="modal" style="display: inline;">
<div class="modal-dialog modal-dialog-scrollable" role="document" style="width: 680px; max-width: 680px;">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Create Product</h5>
<button type="button" class="close" @click="close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div>
<label>Name</label>
<input type="text" class="form-control" v-model="name">
</div>
<div class="mt-2">
<label>Description</label>
<textarea id="summernote" v-model="description"></textarea>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" @click="close">Close</button>
<button type="button" class="btn btn-success" @click="save">Save</button>
</div>
</div>
</div>
</div>
</div>
</transition>
</template>
<script>
export default {
props: [],
data() {
return {
name: null,
description: null,
}
},
methods: {
close() {
this.$emit('close');
},
save() {
var description = document.getElementById("summernote").value;
axios.post('/admin/products', {
name: this.name,
description: description,
}).then((response) => {
});
}
},
mounted(){
$('#summernote').summernote();
}
}
</script>
<style>
.modal-fade-enter,
.modal-fade-leave-active {
opacity: 0;
}
.modal-fade-enter-active,
.modal-fade-leave-active {
transition: opacity .25s ease
解决方案
推荐阅读
- typo3 - 缓存问题:后端和前端的不同域 Typo3
- nginx - NGINX:基于查询字符串的别名或代理
- swift - 自定义单元格未选择不调用委托
- apache-spark - Spark SQL 不会获取 Hive 表架构中的更改
- ansible - Ansible:如何使用变量进行过滤
- c++ - 模板函数如何与可能共享交集的多个类型名一起工作?
- html - 需要帮助将功能添加到 html 中的按钮
- java - FFMPEG JAVA ffmpeg 在 .jar 应用程序中不起作用
- reactjs - 我可以使用 RollupJs 为我的组件库生成组件级 css 文件吗?
- javascript - vue-select:选择具有相同标签的多个选项