【问题标题】:Update image selected via a confirmation dialog更新通过确认对话框选择的图像
【发布时间】:2022-01-09 22:13:10
【问题描述】:

我有一个图像网格,我想从中进行选择并使用所选图像更新值。在这样做之前,我希望有一个提示,它只是检查您是否确实要更新或取消/关闭。

我需要做什么才能用新选择的图像更新以下方法中的“this.backGroundUrl”?

图像网格:

    <v-col
      v-for="(asset) in assets"
      :key="asset._id"
      cols="4"
    >
      <v-img
        :src="getThumbnail(asset)"
        @click="confirmDialog = true"
      />
    </v-col>

确认组件:

<ConfirmDialog
  v-if="confirmDialog"
  v-model="confirmDialog"
  @cancel="confirmDialog = false"
  @confirm="updatedBackgroundImage()"
/>  

资产:

  computed: {
    ...mapState('assets', ['assets']),

方法:

 methods: {
    getThumbnail (asset) {
      return this.getMediaUrl(asset.thumbnailUrl)
    },
    getMediaUrl (url) {
      return process.env.VUE_APP_BACKEND_URL + url
    },
    updatedBackgroundImage () {
      // this.currentConnect.backGroundUrl = ??
      this.confirmDialog = false
    }

【问题讨论】:

    标签: javascript vue.js vuejs2 vuetify.js


    【解决方案1】:

    在打开对话框之前,请隐藏 URL。

    @click="showDialog(asset)"
    
    showDialog(asset) {
      this.theAssetToConfirm = asset
      this.confirmDialog = true
    }
    
    updatedBackgroundImage () {
      this.currentConnect.backGroundUrl = this.theAssetToConfirm
      this.confirmDialog = false
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-05
      • 2017-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-20
      • 2017-01-12
      • 1970-01-01
      相关资源
      最近更新 更多