很多伙伴在写vue3的时候,都使用了组合式api。
而在修改微信小程序的样式的时候,遇到不生效问题,H5却很听话。
其实uniapp有个参数配置,需要开启小程序的样式穿透才行。
那么在Vue3里该如何配置呢?
<script lang="ts">
import { computed, reactive, ref, toRaw } from "vue";
import type { Ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
// 其他代码逻辑
const getAppInfo = (e: string) :void => {};
</script>
<script lang="ts">
export default {
options: { styleIsolation: "shared" },
};
</script>
重点就是第二个script,要分开主代码逻辑去写,以选项式的格式去开启。
快去试试吧!