Browse Source

Merge branch 'zhangtao' of gitadmin/tuoheng_pilot_web into develop

pull/81/head
zhangtao 1 year ago
parent
commit
d1ccedcfa1
1 changed files with 13 additions and 6 deletions
  1. +13
    -6
      src/components/DataTable/tools/Switch.vue

+ 13
- 6
src/components/DataTable/tools/Switch.vue View File

@@ -1,9 +1,9 @@
<template>
<n-switch v-bind="getSwitchProps" v-model:value="switchVlue" @update:value="changeValue" />
<n-switch v-bind="getSwitchProps" v-model:value="getSwitchValue" @update:value="changeValue" />
</template>

<script>
import { defineComponent, ref, unref, computed } from 'vue'
import { defineComponent, unref, computed } from 'vue'
export default defineComponent({
name: 'TableSwitch',
props: {
@@ -18,10 +18,16 @@ export default defineComponent({
},
emits: ['change'],
setup(props, { emit }) {
const switchVlue = ref()
const { data, rowKey } = unref(props)
switchVlue.value = rowKey ? data[rowKey] : data
// const switchValue = ref()
// const { data, rowKey } = unref(props)
// switchValue.value = rowKey ? data[rowKey] : data
const getSwitchValue = computed(() => {
const { data, rowKey } = unref(props)
const value = rowKey ? data[rowKey] : data
return value
})
const getSwitchProps = computed(() => {
console.log(111)
return {
...unref(props)
}
@@ -35,7 +41,8 @@ export default defineComponent({
emit('change', params)
}
return {
switchVlue,
// switchValue,
getSwitchValue,
getSwitchProps,
changeValue
}

Loading…
Cancel
Save