uni-app call [getJSFMVersion] error: jsframework has no such api
uni-app call [getJSFMVersion] error: jsframework has no such api
| 开发环境 | 版本号 | 项目创建方式 |
|---|---|---|
| Mac | 12.7.4 | HBuilderX |
产品分类:uniapp/App
PC开发环境操作系统:Mac
HBuilderX类型:正式
HBuilderX版本号:4.08
手机系统:全部
手机系统版本号:iOS 17
手机厂商:苹果
手机机型:iPhoneXR
页面类型:vue
vue版本:vue3
打包方式:云端
项目创建方式:HBuilderX
测试过的手机:
- 手机:iphoneXR 系统:ios17.4.1
- 手机:小米手机MI 8 系统:MIUI 11.0.4
示例代码:
import { createSSRApp } from 'vue'
import {initRequest} from './util/request/index'
export function createApp() {
const app = createSSRApp(App)
// 引入请求封装
initRequest(app)
app.use(uviewPlus)
return {
app
}
}
首页代码:
<template>
<view class="padding">
<image class="icon" src="../../static/images/icon/launch_icon.png"></image>
<image class="title" src="../../static/images/icon/launch_title.png"></image>
<view class="button" @click="onLaunch">立即开启</view>
</view>
</template>
<script setup>
const onLaunch = () => {
uni.switchTab({
url: '/pages/index/index'
})
}
</script>
.padding {
padding: 240rpx 40rpx 100rpx 40rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.icon {
width: 600rpx;
height: 600rpx;
margin-bottom: 10rpx;
}
.title {
width: 487rpx;
height: 208rpx;
}
.button {
position: fixed;
bottom: 100rpx;
left: 40rpx;
width: 670rpx;
height: 90rpx;
font-family: PingFangSC-Medium;
font-size: 30rpx;
color: #FFFFFF;
line-height: 90rpx;
text-align: center;
font-weight: 500;
border-radius: 45px;
background: $u-primary;
}
更多关于uni-app call [getJSFMVersion] error: jsframework has no such api的实战教程也可以访问 https://www.itying.com/category-93-b0.html
问题我找到了,原因是uview-plus插件注册了color,在小程序没有问题,app使用的时候找不到,代码如下:
// 关于颜色的配置,特殊场景使用
import color from ‘./libs/config/color.js’
// 平台
import platform from ‘./libs/function/platform’
const $u = {
route,
date: index.timeFormat, // 另名date
colorGradient: colorGradient.colorGradient,
hexToRgb: colorGradient.hexToRgb,
rgbToHex: colorGradient.rgbToHex,
colorToRgba: colorGradient.colorToRgba,
test,
type: [‘primary’, ‘success’, ‘error’, ‘warning’, ‘info’],
http: new Request(),
config, // uView配置信息相关,比如版本号
zIndex,
debounce,
throttle,
mixin,
mpMixin,
props,
…index,
color,
platform
}
// $u挂载到uni对象上
uni.$u = $u
更多关于uni-app call [getJSFMVersion] error: jsframework has no such api的实战教程也可以访问 https://www.itying.com/category-93-b0.html
The error message uni-app call [getJSFMVersion] error: jsframework has no such api indicates that the method getJSFMVersion is being called in your uni-app project, but this method does not exist in the current version of the jsframework library that uni-app is using.
Possible Causes and Solutions:
-
Method Does Not Exist:
- The
getJSFMVersionmethod might not be a valid API in the current version of thejsframeworkor uni-app runtime. - Solution: Check the official uni-app documentation or the version of the
jsframeworkyou are using to confirm if this method exists. If it does not, you may need to find an alternative method or update your code to avoid calling this non-existent method.
- The
-
Wrong Version:
- You might be using an outdated version of uni-app or
jsframeworkthat does not support this method. - Solution: Update your uni-app project to the latest version. You can do this by running the following command in your project directory:
Then, rebuild your project.npm update @dcloudio/uni-app
- You might be using an outdated version of uni-app or
-
Custom Method:
getJSFMVersionmight be a custom method that was added in a specific version or fork ofjsframework, but it is not available in the version you are using.- Solution: If this is the case, you may need to implement the method yourself or switch to a version of
jsframeworkthat includes this method.
-
Typo or Incorrect Usage:
- There might be a typo in the method name or it might be used incorrectly in your code.
- Solution: Double-check the method name and its usage in your code. Ensure that you are using the correct API as per the uni-app documentation.
Steps to Troubleshoot:
-
Check the Documentation:
- Refer to the official uni-app documentation to see if
getJSFMVersionis a valid API. You can find the documentation at uni-app official site.
- Refer to the official uni-app documentation to see if
-
Search the Codebase:
- Search your project codebase to see where
getJSFMVersionis being called. Ensure that it is being used correctly and that it is not a typo.
- Search your project codebase to see where
-
Update Dependencies:
- Ensure that all your dependencies, especially
@dcloudio/uni-app, are up to date. You can update them using npm or yarn.
- Ensure that all your dependencies, especially
-
Consult the Community:
- If you are still unable to resolve the issue, consider asking for help on the uni-app community forums or GitHub issues page.
Example of Correct Usage (if the method exists):
If getJSFMVersion is a valid API, it should be used as follows:
const version = uni.getJSFMVersion();
console.log(version);

