当前位置: 首页 > news >正文

网页设计教程教学目的东莞百度seo新网站快速排名

网页设计教程教学目的,东莞百度seo新网站快速排名,flash简单网站模板,外贸怎么上国外的网站一、安装Vant 1、在 资源管理器 空白位置,点右键打开 在外部终端窗口打开 2、初始化NPM npm init -y 3、安装命令 npm i vant/weapp1.3.3 -S --production 4、构建NPM包 在 工具 里选择构建NPM包 5、删除style:v2 在app.json里,删除"style"…

一、安装Vant

1、在 资源管理器 空白位置,点右键打开 在外部终端窗口打开

2、初始化NPM

npm init -y

3、安装命令

npm i @vant/weapp@1.3.3 -S --production

4、构建NPM包

在 工具 里选择构建NPM包

5、删除style:v2

在app.json里,删除"style":"v2"

6、按需引入

// app.json
"usingComponents": {"van-button": "@vant/weapp/button/index"
}

7、使用

<van-button type="primary">按钮</van-button>

二、CSS自定义样式

1、定义

element {--main-bg-color: brown;
}
:root {--main-bg-color: brown;
}

2、使用

element {background-color: var(--main-bg-color: brown);
}

三、自定义TabBar

1、配置

在app.json中的 tabBar 配置中加上 "custom": true, 表示要自定义,不再使用list

为了兼容低版本,list虽然作废,但是也不能删

  "tabBar": {"custom": true,"list": [{....

2、新建自定义文件

在根目录下新建 custom-tab-bar文件夹,在里面新建index文件

 3、引入vant依赖

vant中的tabBar组件介绍:

Vant Weapp - 轻量、可靠的小程序 UI 组件库

 4、基础tabBar

vant中的基本tabBar代码

<van-tabbar active="{{ active }}" bind:change="onChange"><van-tabbar-item icon="home-o">标签</van-tabbar-item><van-tabbar-item icon="search">标签</van-tabbar-item><van-tabbar-item icon="friends-o">标签</van-tabbar-item><van-tabbar-item icon="setting-o">标签</van-tabbar-item>
</van-tabbar>

配套的JS代码

Page({data: {active: 0,},onChange(event) {// event.detail 的值为当前选中项的索引this.setData({ active: event.detail });},
});

自定义图标的使用

icon : 表示未选中 时 显示的图标

icon-active : 表示选中 时 显示的图标

info="3" : 表示图标右上的小数字

<van-tabbar active="{{ active }}" bind:change="onChange"><van-tabbar-item info="3"><imageslot="icon"src="{{ icon.normal }}"mode="aspectFit"style="width: 30px; height: 18px;"/><imageslot="icon-active"src="{{ icon.active }}"mode="aspectFit"style="width: 30px; height: 18px;"/>自定义</van-tabbar-item><van-tabbar-item icon="search">标签</van-tabbar-item><van-tabbar-item icon="setting-o">标签</van-tabbar-item>
</van-tabbar>

配套的JS

Page({data: {active: 0,icon: {normal: 'https://img.yzcdn.cn/vant/user-inactive.png',active: 'https://img.yzcdn.cn/vant/user-active.png',},},onChange(event) {this.setData({ active: event.detail });},
});

最后,把标签的名字和图片都写在list数组里面

data: {"list": [{"pagePath": "/pages/home/home","text": "首页","iconPath": "/images/tabs/home.png","selectedIconPath": "/images/tabs/home-active.png"},{"pagePath": "/pages/message/message","text": "消息","iconPath": "/images/tabs/message.png","selectedIconPath": "/images/tabs/message-active.png",info: 0},{"pagePath": "/pages/contact/contact","text": "联系我们","iconPath": "/images/tabs/contact.png","selectedIconPath": "/images/tabs/contact-active.png"}]}

使用时

<van-tabbar active="{{active}}" bind:change="onChange" active-color="#13A7A0"><van-tabbar-item wx:for="{{list}}" wx:key="index" info="{{item.info ? item.info : ''}}"><image slot="icon" src="{{item.iconPath}}" mode="aspectFit" style="width: 25px; height: 25px;" /><image slot="icon-active" src="{{item.selectedIconPath}}" mode="aspectFit" style="width: 25px; height: 25px;" />{{item.text}}</van-tabbar-item>
</van-tabbar>

在自定义组件中使用 Vant Weapp 组件时,需在 options 开启 styleIsolation: 'shared' 选项,不然修改的样式不会生效

实现跳转Tab功能

    onChange(event) {// event.detail 的值为当前选中项的索引// this.setData({ active: event.detail })this.updateActive(event.detail)wx.switchTab({url: this.data.list[event.detail].pagePath,})},

http://www.yayakq.cn/news/727917/

相关文章:

  • 濮阳公司网站建设企业网页版传奇链接
  • 怎么做健康咨询网站设计师资源网站
  • 济南有哪些网站是做家具团购的泰安有哪些网站
  • 做网站好公司有哪些wordpress wp-login.php
  • 网站适配手机怎么做wordpress 传值
  • 广西建设部投诉网站昆明软讯科技网站建设
  • 网站建设与管理规定100个顺口的公司名字
  • 网站建站模版北京正规网站建设单价
  • 做网站下载哪个软件wordpress kickstart
  • 图片上加语音 网站开发网站建设进度表模板
  • 大型网站建设建站模板网页设计图片怎么居中
  • 网站开发音乐搜索引擎优化实训报告
  • 海口建设工程信息网站建筑业企业所得税2%
  • 建造电商网站区块链开发是什么意思
  • 做淘客app要网站吗中山快速做网站价格
  • 嘉兴网站搜索排名上海市住房城乡建设部网站
  • 陕西省建设业协会网站电子商务网站建设与维护教案
  • 企业网站案例公司python语言基本语句
  • 河南艾特网站建设公司做淘宝网站规范 百度知道
  • win7 添加asp网站邵阳建设网站哪家好
  • 网站构成品牌建设交流问题有哪些
  • 退役厅门户网站建设中标公告做艺术品的网站
  • 济宁祥云网站建设只使用html做简单网站
  • workpress做静态网站wordpress 文章列表只显示标题
  • 泰安网站建设哪里找html5 php网站源码下载
  • 昭通微网站建设网站开发费用预算
  • 石家庄网站做网站东莞石龙网站建设
  • 小公司网站建设现状航达建设网站
  • 网站死链删除深圳洛可可工业设计有限公司
  • 泉州手机网站建设价格网店设计流程图