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

学校网站建设新闻十大免费网站推广平台

学校网站建设新闻,十大免费网站推广平台,国内网络科技网站建设,国际知名的论文网站一、安装Taro UI 进入项目文件,执行项目 //使用yarn安装taro-ui yarn add taro-ui//使用npm安装taro-ui npm install taro-ui//注:因为要支持自定义主题功能,需要将样式从组件中抽离出来,在微信小程序中依赖 globalClass 功能&a…

一、安装Taro UI

进入项目文件,执行项目

//使用yarn安装taro-ui
yarn add taro-ui//使用npm安装taro-ui
npm install taro-ui//注:因为要支持自定义主题功能,需要将样式从组件中抽离出来,在微信小程序中依赖 globalClass 功能,所以需要微信基础库版本在 v2.2.3 以上

配置需要额外编译的源码模块

由于引用 `node_modules` 的模块,默认不会编译,所以需要额外给 H5 配置 `esnextModules`,在 taro 项目的 `config/index.js` 中新增如下配置项

//config/index.js中配置
h5: {esnextModules: ['taro-ui']
}

二、使用Taro UI

1、使用Taro UI需要引入所需要的组件

//引入taro ui的组件及组件样式
import { 组件名 } from 'taro-ui'
import 'taro-ui/dist/style/index.scss'

引入组件样式的三种方法

1、全局引用,在jsx/tsx文件中引用taro ui的所有样式

import 'taro-ui/dist/style/index.scss'

2、全局引用,在css文件中引用taro ui的所有样式

@import "~taro-ui/dist/style/index.scss";

3、按需引用,在页面样式或全局样式中引用taro ui的样式

@import "~taro-ui/dist/style/components/button.scss";

2、具体实例

在【src/pages/index/index.jsx】中编写代码,如下

import { View, Text, Button } from '@tarojs/components'
import { useLoad } from '@tarojs/taro'
import { AtButton } from 'taro-ui'import './index.less'export default function Index () {useLoad(() => {console.log('Page loaded.')})return (<View className='index'><View className='title'>Taro-ui练手项目</View><AtButton loading type='primary' className='btn-question'>提问</AtButton></View>)
}

在上述代码中引入taro-ui中的AtButton按钮

在【app.js】中引入taro-ui的样式文件,全局引入,引入一次即可

import { useLaunch } from '@tarojs/taro'import 'taro-ui/dist/style/components/button.scss'
import './app.less'function App({ children }) {useLaunch(() => {console.log('App launched.')})// children 是将要会渲染的页面return children
}export default App

即引入        import 'taro-ui/dist/style/components/button.scss'

具体实现如下:

Icon图标的使用

//第一种使用方法
<View className='at-icon at-icon-settings'></View>//第二种使用方法
import { AtIcon } from 'taro-ui'
@import "~taro-ui/dist/style/components/icon.scss";
<AtIcon value='clock' size='30' color='#F00'></AtIcon>

Button按钮

import { AtButton } from 'taro-ui'@import "~taro-ui/dist/style/components/button.scss";
@import "~taro-ui/dist/style/components/loading.scss";<AtButton>按钮文案</AtButton>
<AtButton type='primary' size='small'>按钮文案</AtButton>
<AtButton type='secondary' size='normal'>按钮文案</AtButton>
<AtButton loading type='primary'>按钮文案</AtButton>

Fab浮动按钮

浮动悬浮按钮

import { AtFab } from 'taro-ui'
@import "~taro-ui/dist/style/components/fab.scss";<AtFab onClick={this.onButtonClick.bind(this)}><Text className='at-fab__icon at-icon at-icon-menu'></Text>
</AtFab>

Avatar头像

import { AtAvatar } from 'taro-ui'
@import "~taro-ui/dist/style/components/avatar.scss";<AtAvatar circle image='https://jdc.jd.com/img/200'></AtAvatar>

Article文章样式

@import "~taro-ui/dist/style/components/article.scss";<View className='at-article'><View className='at-article__h1'>这是一级标题这是一级标题</View><View className='at-article__info'>2017-05-07&nbsp;&nbsp;&nbsp;这是作者</View><View className='at-article__content'><View className='at-article__section'><View className='at-article__h2'>这是二级标题</View><View className='at-article__h3'>这是三级标题</View><View className='at-article__p'>这是文本段落。这是文本段落。这是文本段落。这是文本段落。这是文本段落。这是文本段落。这是文本段落。这是文本落。这是文本段落。1234567890123456789012345678901234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ</View><View className='at-article__p'>这是文本段落。这是文本段落。</View><Image className='at-article__img' src='https://jdc.jd.com/img/400x400' mode='widthFix' /></View></View>
</View>
.at-article /* 根类名 */
.at-article__h1 /* 一级标题 */
.at-article__h2 /* 二级标题 */
.at-article__h3 /* 三级标题 */
.at-article__info /* 作者信息 */
.at-article__p /* 段落 */
.at-article__img /* 图片 */

Noticlebar通告栏

import { AtNoticebar } from 'taro-ui'<AtNoticebar>这是 NoticeBar 通告栏</AtNoticebar><AtNoticebar icon='volume-plus'>这是 NoticeBar 通告栏,这是 NoticeBar 通告栏,这是 NoticeBar 通告栏
</AtNoticebar><AtNoticebar marquee>滚动:这是 NoticeBar 通告栏,这是 NoticeBar 通告栏,这是 NoticeBar 通告栏
</AtNoticebar>

Swiper滑动视图容器

import { Swiper, SwiperItem } from '@tarojs/components'import Taro, { Component } from '@tarojs/taro'
// 引入 Swiper, SwiperItem 组件
import { Swiper, SwiperItem } from '@tarojs/components'
class App extends Component {render () {return (<SwiperclassName='test-h'indicatorColor='#999'indicatorActiveColor='#333'verticalcircularindicatorDotsautoplay><SwiperItem><View className='demo-text-1'>1</View></SwiperItem><SwiperItem><View className='demo-text-2'>2</View></SwiperItem><SwiperItem><View className='demo-text-3'>3</View></SwiperItem></Swiper>)}
}

Divider分隔符

import { AtDivider } from 'taro-ui'
<AtDivider content='分割线' />

ActionSheet动作面板

import { AtActionSheet, AtActionSheetItem } from "taro-ui"<AtActionSheet isOpened cancelText='取消' title='头部标题可以用通过转义字符换行'><AtActionSheetItem onClick={ this.handleClick }>按钮一</AtActionSheetItem><AtActionSheetItem>按钮二</AtActionSheetItem>
</AtActionSheet>

http://www.yidumall.com/news/84544.html

相关文章:

  • 图文网站模板app优化
  • 备案 网站建设方案书巨量千川广告投放平台
  • 网站 f型市场营销比较好写的论文题目
  • jquery做背景的网站赏析百度免费seo
  • 可以开发哪些网站站长查询工具
  • 网站建设优化网站排名万能软文范例800字
  • 广州在线网站制作推荐关键词优化推广排名
  • 北京环评在那个网站上做网络营销策划的内容
  • 上海最专业的网站建设公司排名会计培训班要多少钱一般要学多久
  • 网页设计与制作模板免费阿里网站seo
  • 网上做结婚照的网站百度软文推广公司
  • seo 网站titleseo综合查询是什么意思
  • 献县网站建设价格网络营销的含义特点
  • 网站获取qq号码 代码搜索引擎优化seo专员招聘
  • 网站做301打不开西地那非能提高硬度吗
  • 网站中留言板怎么做免费web服务器网站
  • wix网站做图片能折叠吗网站搜索优化
  • 素材网免费素材江东seo做关键词优化
  • 郑州建设企业网站找哪个公司广州番禺最新发布
  • app网站建站系统下载广告营销顾问
  • 2008年做的网站网络营销的主要手段和策略
  • 去国外做网站郑州网站推广电话
  • 公司网站的宣传栏怎么做灰色关键词排名
  • 网站公安备案 地址可以变更吗steam交易链接怎么用
  • php动态网站开发是干嘛的企业培训课程开发
  • 物流企业的网站模板免费下载国际重大新闻事件10条
  • 重庆人才招聘网官网百度快照优化培训班
  • 程序员 给老婆做网站泉州百度竞价推广
  • 什么是sem推广长沙网站优化方法
  • 网站建设倒计时代码2021近期时事新闻热点事件简短