0

我正在尝试在我的 nuxt 项目中实现 uploadcare,但似乎无法使其正常工作。

我正在使用uploadcare-vue(https://github.com/tipeio/uploadcare-vue

我按照安装步骤操作,但无法设置公钥。无法在线找到在 nuxt/vue 中设置公钥的正确方法的解决方案,我尝试了多种方法均无济于事。

我觉得自己像个菜鸟。 错误

<template>
...
  <uploadcare
              :publicKey="YOUR_PUBLIC_KEY"
              @success="onSuccess"
              @error="onError"
            >
              <v-btn>New Asset</v-btn>
            </uploadcare> 
...
</template>

<script>
import Uploadcare from 'uploadcare-vue'

export default {
  components: {
    Uploadcare
  },
 data() {
    return {
  ...
   },

  methods: {
    onSuccess() {
      console.log('dede')
    }
  }
}

包.json

 "dependencies": {
    "@fortawesome/fontawesome-svg-core": "^1.2.35",
    "@fortawesome/vue-fontawesome": "^2.0.2",
    "@mdi/js": "^5.9.55",
    "@nuxtjs/fontawesome": "^1.1.2",
    "@nuxtjs/pwa": "^3.0.0-0",
    "@nuxtjs/vercel-builder": "^0.21.2",
    "aos": "^3.0.0-beta.6",
    "gsap": "file:gsap-bonus.tgz",
    "nuxt": "^2.0.0",
    "nuxt-fontawesome": "^0.4.0",
    "nuxt-gsap": "^0.1.4",
    "uploadcare-vue": "^1.0.0",
    "vanilla-tilt": "^1.7.0",
    "vue-head": "^2.2.0",
    "vue-plugin-load-script": "^1.3.2",
    "vue-scrollmagic": "^1.2.0",
    "vue-tilt.js": "^1.1.1"
  },
4

1 回答 1

0

v-bind您正在尝试使用该指令动态设置公钥。相反,您应该使用自定义属性publicKey。请参阅使用道具将数据传递给子组件

<template>
...
  <uploadcare
              publicKey="YOUR_PUBLIC_KEY"
              @success="onSuccess"
              @error="onError"
            >
              <v-btn>New Asset</v-btn>
            </uploadcare> 
...
</template>
于 2021-04-05T18:57:00.920 回答