nuxt.js - 在 buefy/bulma 模态组件中传递 props (nuxtjs)

标签 nuxt.js bulma buefy

如何将 props 传递给要用作 Buefy/Bulma 模态模板的自定义组件?

这就是我声明组件的方式


import myCustomComponent from '~/components/myCustomComponent'

export default {
  components: {
    myCustomComponent ,
  },
  methods: {
  openModal(prop) {
      this.$buefy.modal.open({
        parent: this,
        // here I want to pass my 'prop' to myCustomComponent
        // the equivalent of <myCustomComponent :prop='prop' />
        component: myCustomComponent,
        hasModalCard: true,
        customClass: 'custom-class custom-class-2',
        trapFocus: true,
      })
    },
  }

如何将 prop 传递给组件?谢谢。

最佳答案

我知道这是一个非常晚的回复,但希望这对将来关注此问题的其他人有所帮助。

import myCustomComponent from '~/components/myCustomComponent'

export default {
  components: {
    myCustomComponent ,
  },
  methods: {
  openModal(prop) {
      this.$buefy.modal.open({
        parent: this,
        component: myCustomComponent,
        props: {
            // You can pass your props to the component here
            prop
        },
        hasModalCard: true,
        customClass: 'custom-class custom-class-2',
        trapFocus: true,
      })
    },
  }

关于nuxt.js - 在 buefy/bulma 模态组件中传递 props (nuxtjs),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64820278/

相关文章:

javascript - Vue Webpack 构建破坏了 Bulma CSS

css - 在 buefy 和 bulma 中设置 $primary color 时出现问题

html - 导入 font-awesome 导致 Chrome Mobile 上的 x 轴溢出

javascript - Nuxt.js POST 到 asyncData 内的解析服务器会导致跨域错误

node.js - pm2下如何运行nuxt?

php - Nuxt 与 laravel Sanctuary 收到 "Unauthenticated"消息

html - bool 玛卡的 CSS 样式

vue.js - 如何将 Buefy 的 Dialog 组件与用户提供的内容一起使用并确保 XSS 安全

javascript - Buefy 分页更改事件问题

nuxt.js - 如何为 nuxt-content 编写不区分大小写的查询