import Head from "./conponents/head.vue"
// 引入 ref
import { ref } from 'vue'
const isNeedNav = ref(true)
const changeLossd = () => {
lossdVisible.value = !lossdVisible.value
}
onBeforeMount(() => {})
onMounted(() => {})
onBeforeUpdate(() => {})
onUpdated(() => {})
onBeforeUnmount(() => {})
onUnmounted(() => {})
父:
<Body :twentyFour="twentyFour"></Body>
子:
const porps = defineProps({
twentyFour: String,
})
JS 中取值:
porps.twentyFour
HTML 中取值:
{{ twentyFour }}
父:
<Body @changeInYear="changeInYear" ></Body>
子:
const emit = defineEmits(['changeInYear']); //声明emit
emit('changeInYear')
import { watch } from 'vue'
watch(() => chooseNow.value, () => {
})
:deep(.el-table tr) {
background: transparent;
}
import switchRoom from './switchRoom.vue'
export default {
components: { electricityLoss, switchRoom },
}
import { ref } from 'vue'
export default {
setup(props, contont) {
const chooseNow = ref("用电损耗")
return {
chooseNow,
}
}
}
export default {
setup(props, contont) {
const changeCom = (name) => {
chooseNow.value = name
}
return {
changeCom,
}
}
}
import {
onBeforeMount,
onMounted,
onBeforeUpdate,
onUpdated,
onBeforeUnmount,
onUnmounted,
} from 'vue'
onBeforeMount(() => {})
onMounted(() => {})
onBeforeUpdate(() => {})
onUpdated(() => {})
onBeforeUnmount(() => {})
onUnmounted(() => {})
父:
<inYearDialog :inYearVisible="inYearVisible" :title='title'></inYearDialog>
子:
props: {
inYearVisible: Boolean,
title: String
},
JS 中取值:
setup(props, contont) {
onMounted(() => {
consoloe.log(props.inYearVisible)
})
}
HTML 中取值:
{{ inYearVisible }}