代码更新
This commit is contained in:
@@ -2,14 +2,7 @@
|
||||
<view class=" goods">
|
||||
|
||||
<view class=" u-flex">
|
||||
<view v-if="showChecked">
|
||||
<label class="radio">
|
||||
<radio :color="ColorMain" style="transform: scale(0.7);" @click="radioClick"
|
||||
:checked="data.checked" /><text></text>
|
||||
</label>
|
||||
</view>
|
||||
<up-image width="126rpx" height="126rpx" :src="data.pic" :radius="6"></up-image>
|
||||
<!-- <image mode="aspectFill" :src="data.pic" class="img"></image> -->
|
||||
<view class=" u-p-l-16 u-flex u-p-r-16 u-flex-1 u-col-top">
|
||||
<view class="u-flex-1">
|
||||
<view class="color-333 font-bold">{{data.name}}</view>
|
||||
@@ -26,27 +19,15 @@
|
||||
|
||||
<view class="u-m-t-24 u-flex u-row-between">
|
||||
<view>
|
||||
<!-- <template v-if="data.childrenList.length">
|
||||
<view class="u-flex color-999 u-flex u-col-center" @tap="useTypeClick">
|
||||
<text class="u-font-24">{{computedUserType}} </text>
|
||||
<view class="u-flex">
|
||||
<uni-icons type="right" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</template> -->
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-18 color-999">是否启用</view>
|
||||
<my-switch v-model="isShow" @change="isShowChange"></my-switch>
|
||||
<my-switch v-model="status" @change="statusChange"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-24 u-flex u-row-right">
|
||||
<view class="btn-default btn" @click="del">删除</view>
|
||||
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
|
||||
</view>
|
||||
<!-- <view class="u-flex no-wrap">
|
||||
<view class="btn-default btn" @click="del">删除</view>
|
||||
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -65,7 +46,7 @@
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
|
||||
const emits = defineEmits(['radioClick', 'changeClick', 'useTypeClick', 'del', 'isShowChange'])
|
||||
const emits = defineEmits([ 'changeClick', 'del', 'statusChange'])
|
||||
|
||||
const props = defineProps({
|
||||
index: {
|
||||
@@ -75,65 +56,28 @@
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
isShow: true
|
||||
status: true
|
||||
}
|
||||
}
|
||||
},
|
||||
showChecked: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
let isShow = ref(props.data.isShow)
|
||||
watch(() => props.data.isShow, (newval) => {
|
||||
isShow.value = newval
|
||||
let status = ref(props.data.status)
|
||||
watch(() => props.data.status, (newval) => {
|
||||
status.value = newval
|
||||
})
|
||||
|
||||
function isShowChange() {
|
||||
console.log(isShow.value);
|
||||
emits('isShowChange', {
|
||||
function statusChange() {
|
||||
console.log(status.value);
|
||||
emits('statusChange', {
|
||||
...props.data,
|
||||
isShow: isShow.value
|
||||
status: status.value
|
||||
})
|
||||
}
|
||||
const computedUserType = computed(() => {
|
||||
const len = props.data.useTypes.length
|
||||
const openArr = props.data.useTypes.filter(v => v.isOpen)
|
||||
if (openArr.length <= 0) {
|
||||
return '全部隐藏'
|
||||
}
|
||||
if (openArr.length >= len) {
|
||||
return '全部显示'
|
||||
}
|
||||
let openStr = openArr.reduce((prve, cur) => {
|
||||
return prve + cur.name + '、'
|
||||
}, '')
|
||||
return '显示(' + openStr.slice(0, -1) + ')'
|
||||
})
|
||||
|
||||
let isSellNone = ref(true)
|
||||
isSellNone.value = props.isSellNone
|
||||
|
||||
function isSellNoneChange() {
|
||||
console.log(isSellNone.value);
|
||||
console.log('isSellNoneChange');
|
||||
}
|
||||
|
||||
let checked = ref(false)
|
||||
|
||||
function radioClick() {
|
||||
console.log(props.index);
|
||||
emits('radioClick', props.index)
|
||||
}
|
||||
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index)
|
||||
}
|
||||
|
||||
function useTypeClick() {
|
||||
emits('useTypeClick', props.index)
|
||||
}
|
||||
|
||||
function del() {
|
||||
emits('del', props.index)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user