Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uni-app 记录 #353

Open
toFrankie opened this issue Dec 10, 2024 · 0 comments
Open

uni-app 记录 #353

toFrankie opened this issue Dec 10, 2024 · 0 comments
Labels
2024 2024 年撰写 小程序 与微信、支付宝、百度等小程序相关的文章

Comments

@toFrankie
Copy link
Owner

toFrankie commented Dec 10, 2024

配图源自 Freepik

有些东西隔一段时间不用就容易忘记,在此作下记录。

自定义组件选项配置

诸如 styleIsolation、virtualHost 等自定义组件配置,声明方式如下:

▼ Composition API

若是 Vue3.3+,可使用 defineOptions()

<script setup>
  defineOptions({
    options: {
      virtualHost: false,
      styleIsolation: 'shared',
    },
  })

  // your code...
</script>

若是 Vue3.3 以下,需要独立的 <script> 块。

<script setup>
  // your code...
</script>

<script>
  export default {
    options: {
      virtualHost: false,
      styleIsolation: 'shared',
    },
  }
</script>

▼ Options API

<script>
  export default {
    options: {
      virtualHost: false,
      styleIsolation: 'shared',
    },
  }
</script>
@toFrankie toFrankie added 2024 2024 年撰写 小程序 与微信、支付宝、百度等小程序相关的文章 labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024 2024 年撰写 小程序 与微信、支付宝、百度等小程序相关的文章
Projects
None yet
Development

No branches or pull requests

1 participant