赫乌氨簧_黄
赫乌氨簧_黄
  • 发布:2022-03-23 18:01
  • 更新:2022-08-20 16:54
  • 阅读:280

【报Bug】使用SSR部署到网页托管,无法映射到准确的css文件(映射到index.html)

分类:uniCloud

产品分类: uniCloud/App

操作步骤:

<template>
<unicloud-db v-slot:default="{data, loading, error, options}" collection="opendb-contacts">
<view v-if="error">{{error.message}}</view>
<view v-else>
<uni-list>
<uni-list-item v-for="(item,index) in data" :key="index" :title="item.username" :note="item.email">
</uni-list-item>
</uni-list>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view>更新2323</view>
</view>
</view>
</unicloud-db>
</template>

<script setup>
import {
onLoad,
onShow,
} from "@dcloudio/uni-app";

onLoad(() => {});  
onShow(() => {  
});  

</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.logo {  
    height: 200rpx;  
    width: 200rpx;  
    margin-top: 200rpx;  
    margin-left: auto;  
    margin-right: auto;  
    margin-bottom: 50rpx;  
}  

.text-area {  
    display: flex;  
    justify-content: center;  
}  

.title {  
    font-size: 36rpx;  
    color: #8f8f94;  
}  

</style>

预期结果:

<template>
<unicloud-db v-slot:default="{data, loading, error, options}" collection="opendb-contacts">
<view v-if="error">{{error.message}}</view>
<view v-else>
<uni-list>
<uni-list-item v-for="(item,index) in data" :key="index" :title="item.username" :note="item.email">
</uni-list-item>
</uni-list>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view>更新2323</view>
</view>
</view>
</unicloud-db>
</template>

<script setup>
import {
onLoad,
onShow,
} from "@dcloudio/uni-app";

onLoad(() => {});  
onShow(() => {  
});  

</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.logo {  
    height: 200rpx;  
    width: 200rpx;  
    margin-top: 200rpx;  
    margin-left: auto;  
    margin-right: auto;  
    margin-bottom: 50rpx;  
}  

.text-area {  
    display: flex;  
    justify-content: center;  
}  

.title {  
    font-size: 36rpx;  
    color: #8f8f94;  
}  

</style>

实际结果:

<template>
<unicloud-db v-slot:default="{data, loading, error, options}" collection="opendb-contacts">
<view v-if="error">{{error.message}}</view>
<view v-else>
<uni-list>
<uni-list-item v-for="(item,index) in data" :key="index" :title="item.username" :note="item.email">
</uni-list-item>
</uni-list>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view>更新2323</view>
</view>
</view>
</unicloud-db>
</template>

<script setup>
import {
onLoad,
onShow,
} from "@dcloudio/uni-app";

onLoad(() => {});  
onShow(() => {  
});  

</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

.logo {  
    height: 200rpx;  
    width: 200rpx;  
    margin-top: 200rpx;  
    margin-left: auto;  
    margin-right: auto;  
    margin-bottom: 50rpx;  
}  

.text-area {  
    display: flex;  
    justify-content: center;  
}  

.title {  
    font-size: 36rpx;  
    color: #8f8f94;  
}  

</style>

bug描述:

使用SSR部署到网页托管一直报 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
无法映射到准确的css文件(映射到index.html)

2022-03-23 18:01 负责人:无 分享
已邀请:
cgf876

cgf876

老哥 请问是如何解决的 我也出现了这个问题

要回复问题请先登录注册