当前位置: 首页 > news >正文

郑州seo网站推广怎样优化网站排名

郑州seo网站推广,怎样优化网站排名,pathon做网站,做阿胶上什么网站比较好文章目录 前言步骤1. 构造好前端模版2. 搭建后端存储3. 调试 前言 由于最近写项目需要使用富文本编辑器,使用的是VUE3.0版本所以很多不兼容,实际测试以后推荐使用wangEditor 步骤 构造好前端模版搭建后端存储调试 1. 构造好前端模版 安装模版 模版安…

文章目录

    • 前言
    • 步骤
      • 1. 构造好前端模版
      • 2. 搭建后端存储
      • 3. 调试

前言

由于最近写项目需要使用富文本编辑器,使用的是VUE3.0版本所以很多不兼容,实际测试以后推荐使用wangEditor

步骤

  1. 构造好前端模版
  2. 搭建后端存储
  3. 调试

1. 构造好前端模版

安装模版
模版安装参考:https://www.wangeditor.com/v5/for-frame.html#%E8%B0%83%E7%94%A8-api

上传图片参考:https://www.wangeditor.com/v5/menu-config.html#%E5%9B%BE%E7%89%87
在这里插入图片描述
项目代码:

<template><div style="border: 1px solid #ccc"><Toolbarstyle="border-bottom: 1px solid #ccc":editor="editorRef":defaultConfig="toolbarConfig":mode="mode"/><Editorstyle="height: 500px; overflow-y: hidden;"v-model="valueHtml":defaultConfig="editorConfig":mode="mode"@onCreated="handleCreated"/></div>
</template><script>
import '@wangeditor/editor/dist/css/style.css' // 引入 css
import { onBeforeUnmount, ref, shallowRef, onMounted } from 'vue'
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'export default {components: { Editor, Toolbar },setup() {// 编辑器实例,必须用 shallowRefconst editorRef = shallowRef()// 内容 HTMLconst valueHtml = ref('<p>hello</p>')// 模拟 ajax 异步获取内容onMounted(() => {setTimeout(() => {valueHtml.value = '<p>模拟 Ajax 异步设置内容</p>'}, 1500)})const toolbarConfig = {}const editorConfig = { placeholder: '请输入内容...',MENU_CONF: {uploadImage:{fieldName: 'images',server: '/api/uploadImage',maxSize: 5 * 1024 * 1024, // 5MB}}}// 组件销毁时,也及时销毁编辑器onBeforeUnmount(() => {const editor = editorRef.valueif (editor == null) returneditor.destroy()})const handleCreated = (editor) => {editorRef.value = editor // 记录 editor 实例,重要!}return {editorRef,valueHtml,mode: 'default', // 或 'simple'toolbarConfig,editorConfig,handleCreated,}},}
</script>
<style></style>

2. 搭建后端存储

这边使用的是Laravel框架

namespace App\Http\Controllers\Api;use App\Models\ProductTable;  // 引入模型
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use Intervention\Image\Facades\Image;  // 引入 Intervention Imageclass ProductTableController extends Controller
{public function uploadImage(Request $request){// 验证请求数据$validator = Validator::make($request->all(), ['images' => 'required|image|mimes:jpeg,png,jpg,gif|max:5120',  // 图片字段必填,且文件类型、大小需要满足要求]);// 如果验证失败,返回错误信息if ($validator->fails()) {return response()->json(['errno' => 1, // 错误码为 1'message' => 'Validation failed: ' . $validator->errors()->first(),], 422);}try {// 获取上传的文件$file = $request->file('images');// 生成唯一的文件名,防止文件名重复$filename = uniqid() . '.' . $file->getClientOriginalExtension();// 保存图片到 storage/app/public/images 目录,使用生成的文件名$path = $file->store('images', 'public');// 获取完整的文件 URL,包含 IP 地址或域名$url = request()->getSchemeAndHttpHost() . Storage::url($path);// 返回响应,符合要求的格式return response()->json(['errno' => 0, // 错误码为 0,表示成功'data' => ['url' => $url,  // 图片 URL'alt' => $filename,  // 图片的描述,可以使用文件名作为描述'href' => '', // 图片的链接,可选,暂时为空]], 200);} catch (\Exception $e) {// 捕获异常并返回错误信息return response()->json(['errno' => 1, // 错误码为 1'message' => 'Failed to upload image: ' . $e->getMessage(), // 错误信息], 500);}}
}

注意配置的上传images地址,config/filesystems.php
在这里插入图片描述

3. 调试

在这里插入图片描述

http://www.hengruixuexiao.com/news/34175.html

相关文章:

  • 做钢铁资讯的网站小程序搭建
  • 杭州专业网站建设公司哪家好国际军事新闻今日头条
  • 淘客做网站多少钱seo网站排名优化快速排
  • o2o网站开发公司网站外贸推广
  • 企业网站内容更新怎么操作提供搜索引擎优化公司
  • 网站怎么做收入中国舆情观察网
  • 北京朝阳网站建设教育培训机构推荐
  • .网站开发工具dw网络推广的渠道
  • 网站动态加速免费发广告的平台
  • 广东平台网站建设2021小说排行榜百度风云榜
  • 电商网站后台怎么做优质友情链接
  • gucci网站百度关键词搜索指数查询
  • 网站开发和数据库哪个有前途自己怎么做关键词优化
  • 郑州网站建设公司qq公司免费推广网站
  • 盐城网站开发建设福州seo优化排名推广
  • 3dmax做图那个网站好上海排名优化seo
  • 网站开发分层开发网站
  • 河南网站公司培训方案模板
  • 庆阳做网站公司如何制作一个网页
  • 新网站推广方法东莞市网络营销公司
  • 自己做的美食在哪个网站上卖网络销售是什么
  • 网页设计模板html代码端午节四川seo选哪家
  • 广州品牌网站建设论坛如何做seo
  • wordpress微信排版seo搜索引擎优化排名哪家更专业
  • 什么软件做网站描述百度推广seo自学
  • wordpress首页展示分类页面江苏seo和网络推广
  • 男女做那个暖暖网站百度搜索热度指数
  • 做时时彩开奖网站犯法吗seo哪里可以学
  • 基于目的地的o2o旅游电子商务网站开发设计毕业设计企业产品推广策划方案
  • wordpress做商城网站吗星巴克seo网络推广