最近在写vuex,报过一个这样的错误:
Property or method "$store" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.
属
1、创建项目
打开HbuilderX。创建新项目,选择uni-app默认模板,注意选择vue 3版本。
2、vant3的安装和配置
在创建的项目下右键,使用命令窗口打开所在目录,npm i vant 注意要安装Node.js。
Node.js 安装包及源码下载地址为:下载 | Node.js。
npm i vant 是安装vant3版本
安装好后,在项目目录下就会多出node_modules目录,里面就有用到的vant
main.js中
配置如下
1、路由的使用
一、安装路由
npm i vue-router
二、配置路由
在根目录下创建文件夹router,在router文件夹下创建index.js文件,如下图所示
在index.js文件中写入如下代码,实现创建一个路由器
import VueRouter from "vue-router"
import student from '../view/student'
import school from '../view/school'
const router=new Vue