Vue.js 如何在vue中按状态关闭模式

Vue.js 如何在vue中按状态关闭模式,vue.js,modal-dialog,state,vuex,vuetify.js,Vue.js,Modal Dialog,State,Vuex,Vuetify.js,我正在使用v-dialog组件。我可以按状态弹出v-dialog,但按关闭按钮时无法关闭,该按钮必须获取值false 这是我的密码 <v-dialog :value="productSellingStatus" persistent max-width="290"> <v-card> <v-card-title class="headline">Use Google's location service?</v-card-ti

我正在使用v-dialog组件。我可以按状态弹出v-dialog,但按关闭按钮时无法关闭,该按钮必须获取值false

这是我的密码

<v-dialog :value="productSellingStatus" persistent max-width="290">
      <v-card>
        <v-card-title class="headline">Use Google's location service?</v-card-title>
        <v-card-text>Let Google help apps determine location. This means sending anonymous location data to Google, even when no apps are running.</v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="green darken-1" text @click="!productSellingStatus">Disagree</v-btn>
          <v-btn color="green darken-1" text @click="this.dialog=!productSellingStatus">Agree</v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>


//in script 
computed: {
        ...mapState(["productSellingStatus"]) 

使用谷歌的定位服务?
让谷歌帮助应用程序确定位置。这意味着向谷歌发送匿名位置数据,即使没有应用程序在运行。
不同意
同意
//手稿
计算:{
…映射状态([“productSellingStatus”])

当我的productSellingStatus状态在变异中变为真时,我可以打开模式

您应该在Vuex存储中有一个变异

    [TOGGLE_SELLING_STATUS] (state, bool) {
        state.productSellingStatus = bool
    },
然后从组件中的方法切换它

toggleSellingStatus (val) {
  this.$store.commit('TOGGLE_SELLING_STATUS', val)
},

你应该在Vuex商店里有一个变异

    [TOGGLE_SELLING_STATUS] (state, bool) {
        state.productSellingStatus = bool
    },
然后从组件中的方法切换它

toggleSellingStatus (val) {
  this.$store.commit('TOGGLE_SELLING_STATUS', val)
},

您也可以直接使用$store

$store.state.productSellingStatus=false

<v-btn color="green darken-1" text @click="this.dialog=!$store.state.productSellingStatus">Agree</v-btn>
$store.state.productSellingStatus=false
同意

您也可以直接使用$store

$store.state.productSellingStatus=false

<v-btn color="green darken-1" text @click="this.dialog=!$store.state.productSellingStatus">Agree</v-btn>
$store.state.productSellingStatus=false
同意

这很有效,谢谢,但我不明白为什么它不接受@click=“!productSellingStatus”,而我仍然计算productSellingStatus。这很有效,谢谢,但我不明白为什么它不接受@click=“!productSellingStatus”当我还在计算ProductSellingStatus时,这能回答你的问题吗?这能回答你的问题吗?