Comments (7)
I try to initialize a nuxt project with the command below:
vue init nuxt-community/starter-template nuxt-demo
and then install at-ui
and at-ui-style
yarn add at-ui
yarn add at-ui-style
set the css config in nuxt.config.js
module.exports = {
/*
** Headers of the page
*/
head: {
title: 'nuxt-demo',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'Nuxt.js project' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** Customize the progress bar color
*/
loading: { color: '#3B8070' },
/*
** Build configuration
*/
css: [
'at-ui-style'
],
build: {
extractCSS: true,
/*
** Run ESLint on save
*/
extend (config, ctx) {
if (ctx.dev && ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
}
}
use the components of at-ui
in pages/index.vue
<template>
<section class="container">
<div>
<logo/>
<h1 class="title">
nuxt-demo
</h1>
<h2 class="subtitle">
Nuxt.js project
</h2>
<div class="links">
<a href="https://nuxtjs.org/" target="_blank" class="button--green">Documentation</a>
<a href="https://github.com/nuxt/nuxt.js" target="_blank" class="button--grey">GitHub</a>
</div>
<at-button @click="showMessage">Test</at-button>
</div>
</section>
</template>
<script>
import Vue from 'vue'
import Logo from '~/components/Logo.vue'
import AtComponents from 'at-ui'
Vue.use(AtComponents)
...
It works~
from at-ui.
Try to use global css in Nuxt.js
https://github.com/nuxt/nuxt.js/blob/master/examples/global-css/nuxt.config.js
https://nuxtjs.org/api/configuration-css
from at-ui.
I've set this config in nuxt.config.js
,
css: [
// Load a node module directly (here it's a SASS file)
'at-ui-style',
// CSS file in the project
'@/assets/css/main.css',
// SCSS file in the project
'@/assets/css/main.scss'
]
and got this,
ERROR Failed to compile with 2 errors
These relative modules were not found:
* ../assets/css/main.css in ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["/Users/bluemix/Odoo_OpendEduCat/auc_nuxtjs/node_modules/babel-preset-vue-app/dist/index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./.nuxt/App.vue
* ../assets/css/main.scss in ./node_modules/babel-loader/lib?{"babelrc":false,"cacheDirectory":true,"presets":["/Users/bluemix/Odoo_OpendEduCat/auc_nuxtjs/node_modules/babel-preset-vue-app/dist/index.common.js"]}!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./.nuxt/App.vue
from at-ui.
it seem that main.css
and main.scss
are not in your relative path.
from at-ui.
and the solution? :)
from at-ui.
here is the full nuxt.config.js
file,
module.exports = {
/*
** Headers of the page
*/
head: {
title: 'aux_nuxtjs',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: 'AUC Odoo' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
/*
** Customize the progress bar color
*/
loading: { color: '#3B8070' },
/*
** Build configuration
*/
build: {
/*
** Run ESLint on save
*/
extractCSS: true,
extend (config, ctx) {
if (ctx.dev && ctx.isClient) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}
},
css: [
// Load a node module directly (here it's a SASS file)
'at-ui-style',
// CSS file in the project
'@/assets/css/main.css',
// SCSS file in the project
'@/assets/css/main.scss'
]
}
from at-ui.
now it works 👍
thanks a lot @koppthe
from at-ui.
Related Issues (20)
- Tabs in vertical mode HOT 2
- TextArea not working HOT 1
- table 组件 beforedestroy 函数写成了beforedestory
- at-table 组件渲染完成后当容器发生变化会报出警告错误 HOT 2
- Is this project still being maintained? HOT 1
- Theme color
- AT-UI组件at-Table的选中事件填坑指南
- 兼容性 HOT 1
- 导航组件里的Menu,侧边垂直导航(多级菜单),不支持溢出滚动吗?
- 如何自定义主题?
- tab 组件中不能显示<pre><code><textarea>
- table 排序问题 HOT 1
- 大佬,有AT交流群嘛 HOT 1
- Feature Request: Two Dimensional Range Input HOT 1
- Any progress in this project? HOT 2
- RTL support?
- table 加了optional复选之后,给第n项列设置width会向n-1偏移
- 没有Circle 进度环组件
- 这么好的东西,不再维护,真的太可惜了,见过最好看的UI框架,比ant 和 element 好看多了 HOT 6
- 导航栏夜间模式hover后下面的蓝条显示不全,只能显示左边一点点
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from at-ui.