@hlw-uni/mp-vue 1.1.16 → 1.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
34
|
-
import { computed, useSlots
|
|
34
|
+
import { computed, useSlots } from "vue";
|
|
35
35
|
|
|
36
36
|
type ButtonType =
|
|
37
37
|
| "primary"
|
|
@@ -85,16 +85,12 @@ const emit = defineEmits<{ click: [] }>();
|
|
|
85
85
|
const slots = useSlots();
|
|
86
86
|
const hasIcon = computed(() => Boolean(props.icon || slots.icon));
|
|
87
87
|
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (typeof n.children === "string") return n.children.trim() !== "";
|
|
95
|
-
return true;
|
|
96
|
-
});
|
|
97
|
-
});
|
|
88
|
+
/**
|
|
89
|
+
* 默认 slot 是否有内容,用于避免空 slot 占位影响 flex 布局。
|
|
90
|
+
* 小程序 Vue runtime 的 VNode 结构与标准 Vue 不同,这里仅检测 slot 函数是否存在 —
|
|
91
|
+
* `<hlw-button />` 自闭合时 slots.default 为 undefined;有任何 slot 内容(含 `<hlw-button></hlw-button>` 之外)时为函数。
|
|
92
|
+
*/
|
|
93
|
+
const hasContent = computed(() => Boolean(slots.default));
|
|
98
94
|
|
|
99
95
|
const buttonStyle = computed(() => {
|
|
100
96
|
const style: Record<string, string> = {};
|