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

v-bind in the style module in sfc does not work as expected when using defineCustomCoponent #8826

Closed
GuoJikun opened this issue Jul 22, 2023 · 5 comments · Fixed by #8830
Closed

Comments

@GuoJikun
Copy link

GuoJikun commented Jul 22, 2023

Vue version

3.3.4

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-zm8kzw?file=src%2FApp.vue

Steps to reproduce

No need to do anything, just see it

What is expected?

v-bind works (the font color should be blue in the example)

What is actually happening?

v-bind in the style module in sfc does not work as expected when using defineCustomCoponent.

The css variable generated by v-bind in the custom element should be bound to the host element, but instead, it is bound to the host child element.(在自定义元素中 v-bind 生成的 css 变量未正确绑定到 host 元素)

System Info

No response

Any additional comments?

No response

@Shyam-Chen
Copy link
Contributor

https://vuejs.org/guide/extras/web-components.html

// vite.config.js
import vue from '@vitejs/plugin-vue'

export default {
  plugins: [
    vue({
      template: {
        compilerOptions: {
          // treat all tags with a dash as custom elements
          isCustomElement: (tag) => tag.includes('-')
        }
      }
    })
  ]
}

@GuoJikun
Copy link
Author

https://vuejs.org/guide/extras/web-components.html

// vite.config.js
import vue from '@vitejs/plugin-vue'

export default {
  plugins: [
    vue({
      template: {
        compilerOptions: {
          // treat all tags with a dash as custom elements
          isCustomElement: (tag) => tag.includes('-')
        }
      }
    })
  ]
}

Adding these configurations doesn't help either.

@baiwusanyu-c
Copy link
Member

baiwusanyu-c commented Jul 23, 2023

@GuoJikun
Copy link
Author

GuoJikun commented Jul 24, 2023

Sorry, I had a problem with the previous example, take a look at the following example.
https://stackblitz.com/edit/vitejs-vite-zm8kzw?file=src%2FApp.vue

@yyx990803
Copy link
Member

yyx990803 commented Aug 6, 2024

closed via #8830 (to be released in 3.5)

@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants