diff --git a/ui/packages/basic/AiPullDown.vue b/ui/packages/basic/AiPullDown.vue index c8a089a3..ec5d11af 100644 --- a/ui/packages/basic/AiPullDown.vue +++ b/ui/packages/basic/AiPullDown.vue @@ -14,8 +14,11 @@ export default { name: "AiPullDown", props: { - target: String, - height: {default: 4}, + value: Boolean, + }, + model: { + prop: 'value', + event: 'expand' }, data() { return { @@ -25,32 +28,34 @@ export default { methods: { handleExpand() { this.expand = !this.expand - if (this.target) { - - } else this.$emit('change', this.expandStyle) } }, computed: { btnText() { - return this.expand ? '收起高级搜索' : '展开高级搜索' - }, - expandStyle() { - let initStyle = {overflow: 'hidden', height: `${this.height}px`} - this.expand && (initStyle.height = "auto") - return initStyle + return this.expand ? '收起' : '展开' }, expandIcon() { return this.expand ? 'iconfont iconDouble_Up' : 'iconfont iconDouble_Down' } }, - mounted() { - this.$emit("change", this.expandStyle) + watch: { + expand: { + immediate: true, handler(v) { + this.$emit('expand', v) + } + } } }