Skip to content

Commit

Permalink
feat: 小程序分包,pageA,pageB页面下使用tailwind就会失效 #5
Browse files Browse the repository at this point in the history
  • Loading branch information
sonofmagic committed Feb 21, 2023
1 parent 0cc5ab3 commit bb23c60
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 5 deletions.
3 changes: 0 additions & 3 deletions App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@ export default {
@import "tailwindcss/base";
@import "tailwindcss/utilities";
page {
background-color: gray;
}
</style>
22 changes: 20 additions & 2 deletions pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,23 @@
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
}
"uniIdRouter": {},
"subPackages": [
{
"root": "pagesA",
"pages": [
{
"path": "index"
}
]
},
{
"root": "pagesB",
"pages": [
{
"path": "index"
}
]
}
]
}
2 changes: 2 additions & 0 deletions pages/index/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<view class="w-screen flex flex-col items-center">
<image class="w-12 h-12" src="../../static/logo.png"></image>
<navigator url="/pagesA/index">pagesA</navigator>
<navigator url="/pagesB/index">pagesB</navigator>
<view>
<text class="text-[44px] text-gray-800">{{title}} World</text>
</view>
Expand Down
13 changes: 13 additions & 0 deletions pagesA/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div class="text-[#654321]">
pageA
</div>
</template>

<script>
export default {
}
</script>

<style lang="scss" scoped></style>
13 changes: 13 additions & 0 deletions pagesB/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div class="text-[#123456]">
pageB
</div>
</template>

<script>
export default {
}
</script>

<style lang="scss" scoped></style>
2 changes: 2 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module.exports = {
content: [
resolve("./index.html"),
resolve("./pages/**/*.{vue,js,ts,jsx,tsx,wxml}"),
resolve("./pagesA/**/*.{vue,js,ts,jsx,tsx,wxml}"),
resolve("./pagesB/**/*.{vue,js,ts,jsx,tsx,wxml}"),
],
},
darkMode: false, // or 'media' or 'class'
Expand Down

0 comments on commit bb23c60

Please sign in to comment.