摘要:1. 实现选项卡有几个,内容就有几个 index.vue: 子组件: 2. 实现选项卡内容联动 2.1 list 选项卡内容index 传递给tab: list组件发送事件: 父组件: tab组件接收并改变index: 2.2 tab的activeIndex 传递给 list: 父组件留有监听事件:
阅读全文
摘要:1. 实现中部组件的左右滑动 子组件: 父组件: 2. list-scroll 组件化 组件的组件: 组件:
阅读全文
摘要:1. 效果图 2.list-card代码: <template> <view> <!-- 基础卡片 --> <view v-if="mode == 'base'" class="listcard"> <view class="listcard-image"> <image src="../../st
阅读全文
摘要:1. 中部滚动效果图及实现 1.1 效果图: 1.2 代码: 2. 组件开发 基础卡片视图 效果图: 2.1 创建list-scroll组件,剪切view及样式代码: 2.2 创建list-card组件 样式: <style lang="scss" scope> .listcard { displa
阅读全文
摘要:// 1. 数据库数据 // { // "authors": { // 集合(表名) // "data": [ // 数据 // {"_id": 1, "name": "author 1", "intro": "Two-time best-selling sci-fiction novel
阅读全文
摘要:// 1. 数据库数据 // { // "orders": { // 集合(表名) // "data": [ // 数据 // {"_id":4,"book":"novel 1","price":30,"quantity":2}, // {"_id":5,"book":"science 1"
阅读全文
摘要:1. 效果图 2. 子组件tab中添加clickTab事件及动态样式: 动态样式: 3. 父组件接收事件
阅读全文
摘要:思路:为数据请求搭建一个api框架 1. 原函数请求: 2. 封装get_label 2.1 创建api->index.js 2.2 在main.js中引入 2.3 页面重新渲染 3. 继续封装 3.1 问题: 3.2 创建list.js,剪切const函数内容 3.3 在index.js中引入,此
阅读全文
摘要:// 1. 数据库数据 // { // "items": { // 集合(表名) // "data": [ // 数据 // { // "_id": "1", // "price": 10 // }, // { // "_id": "2", // "price": 50 // }, // { //
阅读全文
摘要:// 1. 数据库数据 // { // "avatar": { // 集合(表名) // "data": [ // 数据 // { // "_id": "1", // "alias": "john", // "region": "asia", // "scores": [40,
阅读全文
摘要:// 1. 数据库数据 // { // "avatar": { // 集合(表名) // "data": [ // 数据 // { // "_id": "1", // "alias": "john", // "region": "asia", // "scores": [40,
阅读全文
摘要:// 1. 数据库数据 // { // "items": { // 集合(表名) // "data": [ // 数据 // { // "_id": 1, // "price": 10.5 // }, // { // "_id": 2, // "price": 50.3 // }, // { //
阅读全文
摘要:// 1. 数据库数据 // { // "items": { // 集合(表名) // "data": [ // 数据 // { // "_id": 1, // "price": 10.5 // }, // { // "_id": 2, // "price": 50.3 // }, // { //
阅读全文
摘要:// 1. 数据库数据 // { // "items": { // 集合(表名) // "data": [ // 数据 // { // "_id": 1, // "price": 10 // }, // { // "_id": 2, // "price": 50 // }, // { // "_id
阅读全文
摘要:// 1. 数据库数据 // { // "vehicles": { // 集合(表名) // "data": [ // 数据 // { // "_id": 1, // "type": "car", // "specs": { // "doors": 4, // "wheels": 4 // } //
阅读全文
摘要:数据表: { "scores": { // 集合(表名) "data": [ // 数据 { "_id": 1, "student": "Maya", "homework": [10, 5, 10], "quiz": [10, 8], "extraCredit": 0 }, { "_id&
阅读全文
摘要:// async位于函数字面量或函数表达式的前面(普通函数,立即执行函数,箭头函数均可),被修饰函数的返回一个Promise对象 // 简化Promise的使用过程,让你的异步代码看起来像是同步的 /* await一定要位于async函数内部 await一般位于Promise对象之前,所以一般位于a
阅读全文
摘要:// 示例1: 效果 => 隔两秒输出resolve里指定的内容 /* new Promise(resolve => { setTimeout(() => { resolve('hello') }, 2000) }).then(res => { console.log(res) }) */ // 示
阅读全文
摘要:思路:获取云函数数据--渲染到组件中 效果图: 1. 创建云函数 get_label 2. 父组件index.vue中获取 3. 子组件tab.vue接收
阅读全文
摘要:img: tab: <template> <view class="tab"> <scroll-view class="tab-scroll" scroll-x> <view class="tab-scroll_box"> <view v-for="(item,index) in list" :ke
阅读全文
摘要:img: 关于小程序导航栏高度计算: nvarbar 组件代码: <template> <view class="navbar"> <!-- 整体fixed --> <!-- 状态栏:20px + 导航栏 45px = 65px 45px暂时的,后面动态获取 --> <view class="nav
阅读全文
摘要:1. 数据库初始化 2. 配置tabbar:
阅读全文
摘要:<template> <view> 首页 <button type="primary" @click="getList">调用get_list云函数</button> <button type="primary" @click="uploadImg">上传图片</button> <button ty
阅读全文
摘要:1. 前台请求数据 getList(){ uniCloud.callFunction({ name:"get_list", data:{ // 请求name 为 name1 的数据 name: 'name1' }, success(res) { console.log(res); }, fail(e
阅读全文
摘要:1. 创建并使用云函数 1.1 创建button调用方法: btn: <button type="primary" @click="getList">调用get_list云函数</button> method: getList(){ uniCloud.callFunction({ name:"get
阅读全文