gpt4 book ai didi

javascript - 如何忽略 Nuxtjs 上的全局 css?

转载 作者:行者123 更新时间:2023-11-27 23:18:04 24 4
gpt4 key购买 nike

我正在使用 boilerplate to CoreUI template , 工作正常,但我想创建一个具有不同样式和 global css 的自定义索引页面从样板文件中覆盖了我的一些自定义样式。

有没有办法让我的布局忽略全局 css?

// pages/index.vue
<template>
<div>
<AnonymousNav/>
<Particles/>
<div class="atividades container">
<About/>
<div class="row text-center">
<Activity v-for="index in 3" :key="index"/>
</div>
<div class="row text-center">
<Activity v-for="index in 3" :key="index"/>
</div>
</div>
<nuxt/>
</div>
</template>
<script>
import AnonymousNav from "../components/anonymous/AnonymousNav";
import Particles from "../components/anonymous/Particles";
import About from "../components/anonymous/About";
import Activity from "../components/anonymous/Activity";

export default {
layout: 'index',
components: {
AnonymousNav,
Particles,
About,
Activity
}
};
</script>
// layouts/index.vue
<template>
<nuxt />
</template>

<script>
export default {
head: {
title: 'Todo',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
// { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
{ rel: 'stylesheet', type: 'text/css', href: 'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css' },
{ rel: 'stylesheet', type: 'text/css', href: '/css/index/style.css' }
],
script: [
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js' },
{ src: 'https://code.jquery.com/jquery-3.3.1.slim.min.js' },
{ src: 'https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js' },
{ src: 'https://cdnjs.cloudflare.com/ajax/libs/particlesjs/2.2.3/particles.min.js' },
{ src: '/js/index/particles.js' },
]
},
}
</script>

最佳答案

不可能忽略特定页面的全局 css,但是您可以通过像这样使用 !important 和 css 技巧来覆盖它

<div class="first_class">
<div class="second_class">
//Do Something
</div>
</div>

使用 CSS 技巧

.first_class .second_class {
//add your css with !important
}

希望对你有帮助

谢谢

关于javascript - 如何忽略 Nuxtjs 上的全局 css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58159208/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com