50 lines
1.2 KiB
Vue
50 lines
1.2 KiB
Vue
<template>
|
|
<div>
|
|
<button @click="handleSwitchChange">点击我</button>
|
|
<p>当前状态: {{ storeStatus }}</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { apiImageUrl } from '../../API/api';
|
|
import { ref } from 'vue';
|
|
|
|
|
|
const storeStatus = ref(0);
|
|
|
|
const handleSwitchChange = () => {
|
|
storeStatus.value = storeStatus.value === 0 ? 1 : 0;
|
|
console.log('当前状态:', storeStatus.value);
|
|
|
|
const data = {
|
|
address: '',
|
|
businessAvatar: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.vNYHZ0vsWMLi4nfLG4rWEwHaE7?rs=1&pid=ImgDetMain',
|
|
businessImages: 'https://tse4-mm.cn.bing.net/th/id/OIP-C.vNYHZ0vsWMLi4nfLG4rWEwHaE7?rs=1&pid=ImgDetMain',
|
|
businessName: '麻辣烫',
|
|
businessPhone: '',
|
|
businessProfile: '',
|
|
categoryId: 0,
|
|
endBusiness: '',
|
|
id: 1830063677349658625,
|
|
startBusiness: '',
|
|
state: 0,
|
|
storeStatus: storeStatus.value,
|
|
userId: 0
|
|
};
|
|
uni.request({
|
|
url:apiImageUrl+'/api/business/update/my',
|
|
method:'POST',
|
|
header: {
|
|
'content-type': 'application/json'
|
|
},
|
|
data: data,
|
|
|
|
success(res) {
|
|
console.log('Success:', res.data);
|
|
},
|
|
fail() {
|
|
console.error('Error:', error);
|
|
}
|
|
})
|
|
};
|
|
</script> |