v-modal和value,input之间的关系

1、v-modal是组件进行双向通讯的政治掮客,角色双重。一方发生变化另一方面就会变化。

2、内部组件接受到 value

3、内部组件通过input进行外测通讯。

内部组件的定义。

<template>
  <div>
    <i-switch
      @on-change="change"
      :value="newType"
      size="large"
      true-color="#13ce66"
      false-color="#ff4949"
    >
      <span slot="open">运行</span>
      <span slot="close">挂起</span>
    </i-switch>
  </div>
</template>

<script>
import { GetDictByType, GetLabelByKey } from "@/utils/StaitcDataIO";
export default {
  methods: {
    GetLabelByKey,
    change: function(ret) {
        this.$emit('on-change',this.value);
    }
  },
  props: ["value"],
  computed: {
    newType: function() {
      if (this.value.status == "pending") {
        return false;
      }
      return true;
    }
  }
};
</script>

<style>
</style>
  <template slot-scope="{ row, index }" slot="status">
          <bushuSwitch @on-change="qiehuan" v-model="row"></bushuSwitch>
        </template>

外测使用

posted on 2020-11-06 10:45  漫思  阅读(767)  评论(0编辑  收藏  举报

导航