@4tw/vue-cli-plugin-vuetify-preset-4tw 中文文档教程
@4tw/vue-cli-plugin-vuetify-preset-4tw
Vuetify 的公司预设。
Usage
安装:
$ yarn add @4tw/vue-cli-plugin-vuetify-preset-4tw
使用预设需要 Vuetify 2.2.0 及更高版本(参见 Vuetify 的 发行说明)。
配置插件:
找到您在项目中配置 Vuetify 的文件,并将预设添加到 Vuetify 配置选项中。 有关如何将预设配置合并到项目中的更多信息,请参阅 Vuetify 的文档。
// src/plugins/vuetify.js
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';
import { preset } from '@4tw/vue-cli-plugin-vuetify-preset-4tw/preset';
Vue.use(Vuetify);
export default new Vuetify({
preset,
});
Roboto 字体:
预设使用默认的 Roboto 字体。 目前,您必须在自己的项目中包含该字体。 这可能会在未来发生变化
编译时间:
以下列方式导入 Vuetify 可能会加快编译时间。 有关详细信息,请参阅此处。
// src/plugins/vuetify.js
import Vuetify from 'vuetify/lib/framework'
Variables
您可以在组件的样式
中使用 Vuetify 的所有 SASS 变量部分。 此外,您可以使用变量 $app-colors
来访问此预设中使用的颜色值。
应用颜色:
可以使用以下颜色。 要使用特定颜色,请像这样使用 map-get mixin:
border: 1px solid map-get($app-colors, 'greydark');
Name | Usage/Examples |
---|---|
primary | Actionable contet like links, buttons |
accent | Use to emphasize importance |
error | System errors, delete buttons |
info | Information snackbar |
success | Success messages, add buttons |
warning | Warning messages, warning icons |
appbargrey | App-Bar background |
greydark | Darker backgrounds, dividers, input fields |
greylight | Lighter backgrounds, buttons |
bodydark | Main textcolor |
bodylight | Light textcolor |
@4tw/vue-cli-plugin-vuetify-preset-4tw
Company Preset for Vuetify.
Usage
Install:
$ yarn add @4tw/vue-cli-plugin-vuetify-preset-4tw
Vuetify version 2.2.0 and higher is required for using presets (see Vuetify's release notes).
Configure Plugin:
Locate the file where you are configuring Vuetify in your project and add the preset to the Vuetify configuration options. See Vuetify's documentation for further information on how the preset configuration is merged into the project.
// src/plugins/vuetify.js
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';
import { preset } from '@4tw/vue-cli-plugin-vuetify-preset-4tw/preset';
Vue.use(Vuetify);
export default new Vuetify({
preset,
});
Roboto Font:
The preset uses the default Roboto font. Currently, you have to include the font in your own project. This might change in the future
Compilation Time:
Importing Vuetify in the following way might speed up compilation time. See here for further information.
// src/plugins/vuetify.js
import Vuetify from 'vuetify/lib/framework'
Variables
You can use all of Vuetify's SASS variables inside your components' style
section. Additionally you can use the variable $app-colors
to access the color values used in this preset.
App Colors:
The following colors are available. To use a particular color, use the map-get mixin like this:
border: 1px solid map-get($app-colors, 'greydark');
Name | Usage/Examples |
---|---|
primary | Actionable contet like links, buttons |
accent | Use to emphasize importance |
error | System errors, delete buttons |
info | Information snackbar |
success | Success messages, add buttons |
warning | Warning messages, warning icons |
appbargrey | App-Bar background |
greydark | Darker backgrounds, dividers, input fields |
greylight | Lighter backgrounds, buttons |
bodydark | Main textcolor |
bodylight | Light textcolor |