chore: 修改生命周期函数
This commit is contained in:
parent
8e85bf818c
commit
8819a4845e
@ -16,13 +16,10 @@ import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
const changeVisible = function() {
|
||||
visible.value = !visible.value;
|
||||
}
|
||||
|
||||
return {
|
||||
visible,
|
||||
changeVisible
|
||||
@ -54,19 +51,14 @@ import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible1 = ref(false)
|
||||
|
||||
const changeVisible1 = function() {
|
||||
visible1.value = !visible1.value;
|
||||
}
|
||||
|
||||
const visible2 = ref(false)
|
||||
|
||||
const changeVisible2 = function() {
|
||||
visible2.value = !visible2.value;
|
||||
}
|
||||
|
||||
return {
|
||||
visible1,
|
||||
visible2,
|
||||
@ -94,14 +86,12 @@ import { layer } from "@layui/layer-vue"
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const openDrawer = function() {
|
||||
layer.drawer({
|
||||
title: "标题",
|
||||
content: "内容"
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
openDrawer
|
||||
}
|
||||
@ -129,7 +119,6 @@ import { layer } from "@layui/layer-vue"
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const openTopDrawer = function() {
|
||||
layer.drawer({
|
||||
title: "标题",
|
||||
@ -137,7 +126,6 @@ export default {
|
||||
offset: "t"
|
||||
})
|
||||
}
|
||||
|
||||
const openBottomDrawer = function() {
|
||||
layer.drawer({
|
||||
title: "标题",
|
||||
@ -145,7 +133,6 @@ export default {
|
||||
offset: "b"
|
||||
})
|
||||
}
|
||||
|
||||
const openLeftDrawer = function() {
|
||||
layer.drawer({
|
||||
title: "标题",
|
||||
@ -153,7 +140,6 @@ export default {
|
||||
offset: "l"
|
||||
})
|
||||
}
|
||||
|
||||
const openRightDrawer = function() {
|
||||
layer.drawer({
|
||||
title: "标题",
|
||||
@ -161,7 +147,6 @@ export default {
|
||||
offset: "r"
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
openTopDrawer,
|
||||
openBottomDrawer,
|
||||
|
@ -18,13 +18,10 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible1 = ref(false)
|
||||
|
||||
const changeVisible1 = function() {
|
||||
visible1.value = !visible1.value
|
||||
}
|
||||
|
||||
return {
|
||||
visible1
|
||||
};
|
||||
@ -51,13 +48,10 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible2 = ref(false)
|
||||
|
||||
const changeVisible2 = function() {
|
||||
visible2.value = !visible2.value
|
||||
}
|
||||
|
||||
return {
|
||||
visible2
|
||||
};
|
||||
@ -84,13 +78,10 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible3 = ref(false)
|
||||
|
||||
const changeVisible3 = function() {
|
||||
visible3.value = !visible3.value
|
||||
}
|
||||
|
||||
return {
|
||||
visible3
|
||||
};
|
||||
@ -117,13 +108,10 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible4 = ref(false)
|
||||
|
||||
const changeVisible4 = function() {
|
||||
visible4.value = !visible4.value
|
||||
}
|
||||
|
||||
return {
|
||||
visible4
|
||||
};
|
||||
@ -150,13 +138,10 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible8 = ref(false)
|
||||
|
||||
const changeVisible8 = function() {
|
||||
visible8.value = !visible8.value
|
||||
}
|
||||
|
||||
return {
|
||||
visible8
|
||||
};
|
||||
@ -181,14 +166,11 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const type5 = ref(2)
|
||||
const visible5 = ref(false)
|
||||
|
||||
const changeVisible5 = function() {
|
||||
visible5.value = !visible5.value
|
||||
}
|
||||
|
||||
return {
|
||||
type5,
|
||||
visible5
|
||||
@ -216,17 +198,14 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible6 = ref(false)
|
||||
const btn6 = [
|
||||
{text:'确认', callback: ()=>{ alert("确认事件") }},
|
||||
{text:'取消', callback: ()=>{ alert("取消事件") }}
|
||||
]
|
||||
|
||||
const changeVisible6 = function() {
|
||||
visible6.value = !visible6.value
|
||||
}
|
||||
|
||||
return {
|
||||
btn6,
|
||||
visible6
|
||||
@ -254,13 +233,10 @@ import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const visible7 = ref(false)
|
||||
|
||||
const changeVisible7 = function() {
|
||||
visible7.value = !visible7.value
|
||||
}
|
||||
|
||||
return {
|
||||
visible7
|
||||
};
|
||||
@ -287,21 +263,16 @@ import { layer } from "@layui/layer-vue"
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
let id = null;
|
||||
|
||||
const open = function() {
|
||||
id = layer.open({title:"标题",content:"内容", shade: false})
|
||||
}
|
||||
|
||||
const close = function() {
|
||||
layer.close(id)
|
||||
}
|
||||
|
||||
const closeAll = function() {
|
||||
layer.closeAll()
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
|
@ -15,9 +15,8 @@ import { layer } from "@layui/layer-vue"
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const openMsg = function() {
|
||||
layer.msg("普通消息", { time: 100000 })
|
||||
layer.msg("普通消息", { time: 1000 })
|
||||
}
|
||||
return {
|
||||
openMsg
|
||||
@ -46,27 +45,21 @@ import { layer } from "@layui/layer-vue"
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
|
||||
const openSuccess = function() {
|
||||
layer.msg("成功消息", { icon : 1, time: 100000})
|
||||
}
|
||||
|
||||
const openFailure = function() {
|
||||
layer.msg("失败消息", { icon : 2, time: 1000})
|
||||
}
|
||||
|
||||
const openWarning = function() {
|
||||
layer.msg("警告消息", { icon : 3, time: 1000})
|
||||
}
|
||||
|
||||
const openPrimary = function() {
|
||||
layer.msg("详情消息", { icon : 4, time: 1000})
|
||||
}
|
||||
|
||||
const openLoading = function() {
|
||||
layer.msg("加载消息", { icon : 16, time: 1000})
|
||||
}
|
||||
|
||||
return {
|
||||
openSuccess, openFailure, openWarning, openPrimary, openLoading
|
||||
}
|
||||
|
@ -30,8 +30,7 @@
|
||||
"build:example": "vite build example",
|
||||
"lint:eslint": "eslint 'src/**/*.{vue,ts,tsx}' --fix",
|
||||
"lint:prettier": "prettier --write \"src/**/*.{vue,ts}\"",
|
||||
"prepare": "husky install",
|
||||
"postinstall": "npm run prepare",
|
||||
"postinstall": "husky install",
|
||||
"commit": "git-cz",
|
||||
"commit:push": "git add . && git-cz && git push"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user