vue-markdown icon indicating copy to clipboard operation
vue-markdown copied to clipboard

Scoped class does not work on vue-markdown component

Open maziarz opened this issue 8 years ago • 4 comments

When i attach a class to the vue-markdown component it is not being styled accordingly.

Example:

<template lang="pug">
    vue-markdown(:source="mydata", class="vue-md")
</template>

<script>
import VueMarkDown from 'vue-markdown'

export default {
    components: {
        VueMarkDown
    }
}
</script>

<style lang="scss" scoped>
.vue-md {
    color: yellow !important;
}
</style>

maziarz avatar May 31 '17 12:05 maziarz

I run this code and get HTML script like this, which look like all right:

<div class="vue-md">what you define in "mydata"<div>

May you paste the HTML script you got ? thx~

miaolz123 avatar Jul 23 '17 07:07 miaolz123

I've run into the same problem.

This happens due to the behavior of setting <style> tags to scoped. This gives all elements in the component a unique data-v-[hash] property, which isn't being set on the children of vue-markdown.

Example

beeequeue avatar Dec 12 '17 01:12 beeequeue

Same problem for me. As a workaround, i add my scoped css in my global css file

Evild67 avatar Dec 15 '17 13:12 Evild67

Same problem for me. As a workaround, i add my scoped css in my global css file

This worked for me

blackchineykh avatar Sep 05 '19 15:09 blackchineykh