mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore(cli): demo-block add demoName class
This commit is contained in:
parent
b5cd336bb8
commit
8b8ddd6522
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="van-doc-demo-block">
|
||||
<div class="van-doc-demo-block" :class="demoName">
|
||||
<h2 v-if="title" class="van-doc-demo-block__title">{{ title }}</h2>
|
||||
<div v-if="card" class="van-doc-demo-block__card">
|
||||
<slot />
|
||||
@ -9,6 +9,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { decamelize } from '../../common';
|
||||
|
||||
export default {
|
||||
name: 'demo-block',
|
||||
|
||||
@ -16,6 +18,17 @@ export default {
|
||||
card: Boolean,
|
||||
title: String,
|
||||
},
|
||||
|
||||
computed: {
|
||||
demoName() {
|
||||
const { meta } = this.$route || {};
|
||||
if (meta && meta.name) {
|
||||
return `demo-${decamelize(meta.name)}`;
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user