添加 backable 控制返回按钮是否可用
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<view v-if="showBack" class="cl-topbar__icon" @tap="back()">
|
||||
<cl-icon
|
||||
:pt="{
|
||||
className: pt.back?.className
|
||||
className: parseClass([[!backable, 'opacity-50'], pt.back?.className])
|
||||
}"
|
||||
:name="backIcon"
|
||||
:size="pt.back?.size ?? 48"
|
||||
@@ -82,6 +82,11 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 是否可以返回
|
||||
backable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
// 返回按钮的跳转路径
|
||||
backPath: {
|
||||
type: String,
|
||||
@@ -195,6 +200,7 @@ const topbarStyle = computed(() => {
|
||||
|
||||
// 返回按钮点击事件
|
||||
function back() {
|
||||
if (props.backable) {
|
||||
if (props.backPath != "") {
|
||||
router.to(props.backPath);
|
||||
} else {
|
||||
@@ -205,6 +211,7 @@ function back() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user