tmagic-editor icon indicating copy to clipboard operation
tmagic-editor copied to clipboard

如何实现图片上传替换填写链接

Open AndyCuiYTT opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

AndyCuiYTT avatar Apr 29 '23 01:04 AndyCuiYTT

我也想知道

nbvghost avatar Jul 22 '23 09:07 nbvghost

Uploading Snipaste_2023-11-28_16-33-00.png… 我是这样实现的,希望能给你参考。

  1. 开发并注册一个组件,以m-fields-开头
app.component(`m-fields-upload-select`, UploadSelect)

组件的具体写法参考官方写的,如@tmagic/form/src/fields/Text.vue等。 具体上传需要自己实现 2. 修改image组件的config,加入如下配置

{
    text: '上传',
    name: 'src',
    src: 'component',
    type: 'upload-select',
}

shelli-site avatar Nov 28 '23 08:11 shelli-site

我这边也遇到了这样的需求。 分享一下我解决方案和遇到的问题:

  1. 在@tmagic/form/src/ 中新增 Upload,vue 组件;
  2. 组件上传成功后,不能拿本地图片资源进行预览,遇到了一个bug:切换到其他地方后再切回来,会出现图片资源丢失问题;
  3. 最后我的做法是,上传图片后,将链接回写到url中,进行显示; image

Linzsong avatar Jul 24 '24 02:07 Linzsong