Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AndyCuiYTT opened this issue Apr 29, 2023 · 3 comments
Open

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

AndyCuiYTT opened this issue Apr 29, 2023 · 3 comments

Comments

@AndyCuiYTT
Copy link

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.

@nbvghost
Copy link

我也想知道

@shelli-site
Copy link

shelli-site commented Nov 28, 2023

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',
}

@Linzsong
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants