// Vuejs組件如何加載SCSS在vue.js
<template>
<form class="form form--login" v-on:submit.prevent="login">
<h2 class="form__title">Login</h2>
<div class="info info--error" v-if="infoError">Login failed. Please try again.</div>
<div :class="{'is-waiting': loader}">
<div class="form-block">
<input v-model.trim="username" class="field" name="username" type="text" placeholder="User ID" required>
</div>
<div class="form-block">
<input v-model.trim="password" class="field" name="password" type="password" placeholder="Password" required>
</div>
<div class="form-block form__actions">
<router-link to="/password-reset">Lost your password?</router-link>
<button class="button button--green form__submit">Login</button>
</div>
</div>
</form>
</template>
<script>
<style lang="scss" type="text/scss">
.is-waiting {
position: relative;
transition-duration: .3s;
> * {
opacity: .25;
}
&:before {
content: '';
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
z-index: 9;
}
&:after {
background: {
position: center;
size: cover;
}
content: '';
height: 64px;
left: 50%;
position: absolute;
top: 50%;
transform: translate(-50%, -50%);
width: 64px;
}
}
</style>
//webpack.config
"dependencies": {
"onsenui": "^2.5.1",
"node-sass": "^4.5.0",
"sass-loader": "^5.0.1",
"vue": "^2.4.2",
"vue-onsenui": "^2.1.0",
"vue-resource": "^1.3.4",
"vuex": "^2.3.1"
},
我仍然成分無法正確加載風格。
請幫忙!!
看起來非常簡單。沒有linting錯誤或任何東西? –
就像你說的那樣,它不會加載。只是確認它是否應用樣式或不加載文檔中的所有 –
哦,那麼它是一個CSS問題,而不是一個vue問題。這些類在DOM檢查上是否正確? –