uni-app uview框架引入无效

uni-app uview框架引入无效

项目信息 详细信息
产品分类 uniapp/App
PC开发环境 Windows
PC开发环境版本 win10
HBuilderX类型 正式
HBuilderX版本 3.99
手机系统 Android
手机系统版本 Android 14
手机厂商 vivo
手机机型 iqoo11pro
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX

操作步骤:

  • 使用uview组件单选按钮

预期结果:

  • 显示uview组件单选按钮

实际结果:

  • 按照文档都引入好了,uview自定义基座运行后,一进入使用uview组件的页面就报错,第一次进入报错TypeError: Cannot read property 'props' of undefined,第二次进入报错[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

bug描述:

  • 按照文档都引入好了,uview自定义基座运行后,一进入使用uview组件的页面就报错,第一次进入报错TypeError: Cannot read property 'props' of undefined,第二次进入报错[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

更多关于uni-app uview框架引入无效的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

第三方插件请到插件市场下评论区回复或者私信作者

更多关于uni-app uview框架引入无效的实战教程也可以访问 https://www.itying.com/category-93-b0.html


确实是框架问题,应该很久没人维护了,其他框架就好使,uview总榜第一,87W下载量还这么多问题

回复 5***@qq.com: 建议使用我们官方的uni-ui,官方的uni-ui是一直都有在不停维护的。

uni-app 中使用 uView 框架时,如果引入无效,可能是由于以下几个原因导致的。你可以按照以下步骤进行排查和解决:

1. 确保正确安装 uView

首先,确保你已经正确安装了 uView。可以通过以下命令安装:

npm install uview-ui

或者使用 yarn

yarn add uview-ui

2. 在 main.js 中引入 uView

main.js 文件中,确保你已经正确引入了 uView 并进行了配置:

import uView from 'uview-ui';
Vue.use(uView);

3. 配置 uni.scss

uni.scss 文件中引入 uView 的主题样式:

@import 'uview-ui/theme.scss';

4. 配置 pages.json

pages.json 中,确保你已经配置了 easycom 自动引入组件:

{
  "easycom": {
    "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
  }
}

5. 检查组件使用

确保你在页面中正确使用了 uView 的组件。例如:

<template>
  <view>
    <u-button type="primary">按钮</u-button>
  </view>
</template>
回到顶部