1

首先,我将 main.js 文件与 bundle.js 捆绑在一起

我的 main.js:

const Uppy = require('@uppy/core');
const XHRUpload = require('@uppy/xhr-upload');
const Dashboard = require('@uppy/dashboard');
const Webcam = require('@uppy/webcam');
const ImageEditor = require('@uppy/image-editor')

const uppy = new Uppy({
    id: 'uppy',
    autoProceed: false,
    restrictions: {
        maxFileSize: null,
        minFileSize: null,
        maxTotalFileSize: null,
        maxNumberOfFiles: null,
        minNumberOfFiles: null,
        allowedFileTypes: null
      }
     
}).use(Dashboard,{
    inline: true,
    target:'#drag-drop-area',
    width: 700,
    height: 400,
   
})
.use(XHRUpload,{
    endpoint: 'http://localhost:3000/image',
    fieldName:'photo',
    formData: true
})
.use(Webcam,{target:Dashboard})
.use(ImageEditor, {
    target: Dashboard,
    quality: 0.8
  });

现在我希望我的 main.js 文件中的这部分对于我网站中的不同页面(例如端点、maxsFileSize等)有所不同:-

const uppy = new Uppy({
    id: 'uppy',
    autoProceed: false,
    restrictions: {
        maxFileSize: null,
        minFileSize: null,
        maxTotalFileSize: null,
        maxNumberOfFiles: null,
        minNumberOfFiles: null,
        allowedFileTypes: null
      }
     
}).use(Dashboard,{
    inline: true,
    target:'#drag-drop-area',
    width: 700,
    height: 400,
   
})
.use(XHRUpload,{
    endpoint: 'http://localhost:3000/image',
    fieldName:'photo',
    formData: true
})
.use(Webcam,{target:Dashboard})
.use(ImageEditor, {
    target: Dashboard,
    quality: 0.8
  });

console.log('puuppy');

我怎么做。请帮忙..!! 我阅读了--standalone但没有如何将它应用于我的问题

4

0 回答 0