【发布时间】:2021-07-15 13:09:10
【问题描述】:
我想在这里添加字体样式,如果您希望字体为 arial、san-serif 等,有一个选项...但是现在 vue2-editor 中不显示字体和字体大小。谁能帮帮我?
您可以在此处访问代码:
https://codesandbox.io/s/liz23?file=/src/App.vue:0-553
这是代码:
<template>
<div id="app">
<vue-editor v-model="content"></vue-editor>
<div v-html="content"></div>
</div>
</template>
<script>
import { VueEditor } from "vue2-editor";
export default {
components: {
VueEditor
},
data() {
return {
content: "<p>Some initial content</p>"
};
}
};
</script>
<style>
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* text-align: center; */
color: #2c3e50;
margin-top: 60px;
}
</style>
【问题讨论】:
-
我的假设是您想在整个应用程序中设置此字体和颜色?为什么不在 index.vue 文件中使用 html *{
}? -
@Jamie CSS 并不理想,例如,如果 OP 想要将样式直接保留在富文本本身中。
-
@Terry 我的错误我看错了他们想要他们的风格。