Files
element-plus/docs/examples/border/shadow.vue
BigFrontEnd-China 09389cc750 docs: remove the border in the shadow example (#3863)
Co-authored-by: 三咲智子 <sxzz@sxzz.moe>
2021-10-29 16:56:26 +08:00

54 lines
1.0 KiB
Vue

<template>
<div>
<template v-for="(shadow, i) in shadowGroup" :key="i">
<div
class="demo-shadow"
:style="{ boxShadow: `var(--el-box-shadow-${shadow.type})` }"
></div>
<span class="demo-shadow-text"
>{{ shadow.name }}
<code>box-shadow: {{ getValue(shadow.type) }}</code></span
>
</template>
</div>
</template>
<script lang="ts">
export default {
data() {
return {
shadowGroup: [
{
name: 'Basic Shadow',
type: 'base',
},
{
name: 'Light Shadow',
type: 'light',
},
],
}
},
methods: {
getValue(type) {
const getCssVarValue = (prefix, type) =>
getComputedStyle(document.documentElement).getPropertyValue(
`--el-${prefix}-${type}`
)
return getCssVarValue('box-shadow', type)
},
},
}
</script>
<style scoped>
.demo-shadow {
height: 100px;
width: 50%;
}
.demo-shadow-text {
line-height: 50px;
color: var(--el-text-color-regular);
font-size: 14px;
}
</style>