<template>
<div class="example">{{ msg }}</div>
</template>
<script>
export default {
data () {
return {
msg: 'Hello world!'
}
}
}
</script>
<style>
.example {
color: red;
}
</style>
<style lang="sass"> /* write SASS! */ </style>
<template src="./template.html"></template> <style src="./style.css"></style> <script src="./script.js"></script>
npm install -g vue-cli vue init webpack-simple hello-vue cd hello-vue npm install npm run dev # ready to go!
<script>
import ComponentA from './ComponentA.vue'
import ComponentB from './ComponentB.vue'
export default {
components: {
ComponentA,
ComponentB
}
}
</script>
<div :class="[{ active: active }, isButton ? prefix + '-button' : null]">
<div :class="{ active, [`${prefix}-button`]: isButton }">
<style scoped>
.example {
color: red;
}
</style>
<template>
<div class="example">hi</div>
</template>
<style>
.example[_v-f3f3eg9] {
color: red;
}
</style>
<template>
<div class="example" _v-f3f3eg9>hi</div>
</template>
<style> /* global styles */ </style> <style scoped> /* local styles */ </style>
<style module>
.red {
color: red;
}
.bold {
font-weight: bold;
}
</style>
<template> <p :class="$style.red"> This should be red </p> </template>
<template>
<div>
<p :class="{ [$style.red]: isRed }">
Am I red?
</p>
<p :class="[$style.red, $style.bold]">
Red and bold
</p>
</div>
</template>
<script>
export default {
created () {
console.log(this.$style.red)
// -> "_1VyoJ-uZOjlOxP7jWUy19_0"
// an identifier generated based on filename and className.
}
}
</script>
<style module="a"> /* identifiers injected as $a */ </style> <style module="b"> /* identifiers injected as $b */ </style>
{
modules: true,
importLoaders: true,
localIdentName: '[hash:base64]'
}
// wepback 1
vue: {
cssModules: {
// overwrite local ident name
localIdentName: '[path][name]---[local]---[hash:base64:5]',
// enable camelCase
camelCase: true
}
}
// webpack 2
module: {
rules: [
{
test: '\.vue$',
loader: 'vue',
options: {
cssModules: {
localIdentName: '[path][name]---[local]---[hash:base64:5]',
camelCase: true
}
}
}
]
}
// webpack.config.js
module.exports = {
// other configs...
vue: {
// use custom postcss plugins
postcss: [require('postcss-cssnext')()]
}
}
// webpack.config.js
module.exports = {
// other configs...
plugins: [
new webpack.LoaderOptionsPlugin({
vue: {
// use custom postcss plugins
postcss: [require('postcss-cssnext')()]
}
})
]
}
postcss: {
plugins: [...], // list of plugins
options: {
parser: sugarss // use sugarss parser
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有