十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
Vue.js中如何使用wangEditor富文本编辑器,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

成都创新互联公司主营万安网站建设的网络公司,主营网站建设方案,成都app软件开发公司,万安h5微信小程序开发搭建,万安网站营销推广欢迎万安等地区企业咨询
欢迎使用 wangEditor 富文本编辑器
添加
from django.conf.urls import patterns from home_application import host_view urlpatterns = patterns( 'home_application.views', (r'^$', 'home'), (r'^api/test/$', "test"), (r'^upload_img/$', host_view.upload_img), (r'^media/(?P\d+).(?P \w+)', host_view.get_media), ... )
import os
import time
from django.views.decorators.csrf import csrf_exempt
from django.http import JsonResponse, HttpResponse
from django.utils.encoding import escape_uri_path
def check_upload_wrapper(func):
def inner(*args, **kwargs):
if not os.path.exists("media/"):
os.makedirs("media/")
return func(*args, **kwargs)
return inner
def create_blog(request):
data = json.loads(request.body)
content = data.get("content")
print(content)
return JsonResponse({"result": True})
def get_media(request, name, postfix):
file_name = name + "." + postfix
file_path = os.path.join("media", file_name)
file = open(file_path, 'rb')
response = HttpResponse(file)
response['Content-Type'] = 'application/octet-stream'
response['Content-Disposition'] = "attachment;filename*=utf-8''{}".format(escape_uri_path(file_name))
return response
@csrf_exempt
@check_upload_wrapper
def upload_img(request):
file_list = []
for k, v in request.FILES.items():
t = time.strftime('%Y%m%d%H%M%S')
now_file_name = t + '.' + k.split('.')[-1]
file_path = os.path.join('media', now_file_name)
with open(file_path, "ab") as f:
f.write(v.read())
file_list.append("/" + file_path)
return JsonResponse({"errno": 0, "data": file_list})关于Vue.js中如何使用wangEditor富文本编辑器问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注创新互联行业资讯频道了解更多相关知识。