微信小程序之入门(2)

知识点重要程度分为五级:***************

text文本 *****

关键词:textselectable

语法及代码:

wxml

<text  selected=’true’  class=’sayhi’>大家好,我是name</text>

wxss

.sayhi{

  color:red;

  font-size:30rpx;

}

js

page{{

  data:{

    name:’啦啦啦’

}}

 

5.prograss进度条 ****

关键词:prograsspercentshow-infostroke-widthactivebackgroundcoloractiveColor

语法及代码:

wxml

<prograss  percent=’80’  show-info  stroke-width=’6’ ></prograss>

<prograss  percent=’{{ percent }}’  show-info  stroke-width=’26’ 

backgroundcolor=’gray’  activeColor=’green’  active></prograss>

js

page{{

  data:{

name:’武振华’,

percent:’65’

}}

 

 

6.button 按钮 *****

关键词:buttonsizedefaultminitypeprimarywarndisabledplain

语法及代码:

wxml

<button  size=’default’ >点击我</button>

<button  size=’mini’>点击我</button>

<button  size=’default’  type=’primary’>点击我</button>

<button  size=’default’  type=’warn’>点击我</button>

<button  size=’default’  type=’warn’  plain=’true’>点击我</button>

<button  size=’default’  type=’warn’  disabled=’true’>点击我</button>

<button  bindtap=’SayHi’ >点击我</button>

js

Page{

data:{

},

 

SayHi:function(){

  console.log(‘ Hi ’)

},

7.checkbox 多选按钮 ***

关键词:checkboxcheckbox-groupdisabledcheckedcolorconsoledetailfunctionev(event事件)logvalue

语法及代码:

wxml

<checkbox-group  bindtap=’change’>

  <checkbox  value=’1’  disabled=’true’> 1 </checkbox>

  <checkbox  value=’2’  checked=’true’> 2 </checkbox>

  <checkbox  value=’3’  color=’red’> 3 </checkbox>

</checkbox-group>

js

Page{

data:{

},

 

change:function(ev){

  console.log(‘ ev.detail.value ’)

},

 

 

8.checkbox 多选按钮 ***

关键词:checkboxcheckbox-groupdisabledcheckedcolorconsoledetailfunctionev(event事件)logvalue

语法及代码:

wxml

<checkbox-group  bindtap=’change’>

  <checkbox  value=’1’  disabled=’true’> 1 </checkbox>

  <checkbox  value=’2’  checked=’true’> 2 </checkbox>

  <checkbox  value=’3’  color=’red’> 3 </checkbox>

</checkbox-group>

js

Page{

data:{

},

 

change:function(ev){

  console.log(‘ ev.detail.value ’)

},

 

9.input 输入框 ***

关键词:inputvalueplacehoderpassworddisabled

语法及代码:

wxml

<input  value=’你是谁’></input>

<input  placehoder=’你的名字’></input>

<input  password=’true’></input>

<input  placehoder=’禁止输入’  disabled></input>

 

10. radio 单选按钮 **

关键词:radioradio-groupbindchangeradio-groupvaluecolordisabledcheckedswitch

语法及代码:

wxml

<switch  color=’red’  checked=’true’  bindchange=’change’>开关</switch>

<radio-group  bindchanges=’change’>

  <radio  value=’1’> 1 </radio>

  <radio  value=’2’> 2 </radio>

  <radio  value=’3’  color=’red’  checked=’true’> 3 </radio>

  <radio  value=’4’  disabled> 4 </radio>

</radio-group>

js

Page{

data:{

},

 

change:function(ev){

  console.log(‘ ev.detail.value ’)

},

11. 表单提交 ****

关键词:formbindsubmitinputnameplacehodercheckbox-groupvaluebuttonform-typesubmit

语法及代码:

wxml

<form  bindsubmit=’change’>

  <input  name=’username’  placehoder=’你的名字’></input>

  <checkbox-group  name=’number’>

<checkbox  value=’1’>1</checkbox>

    <checkbox  value=’2’>2</checkbox>

    <checkbox  value=’3’>3</checkbox>

    <checkbox  value=’4’>4</checkbox>

  </checkbox-group>

<radio-group  name=’letter’>

  <radio  value=’a’>  a  </radio>

  <radio  value=’a’>  b  </radio>

  <radio  value=’c’>  c  </radio>

  <radio  value=’d’>  d  </radio>

</radio-group>

<button  form-type=’submit’>提交</button>

</form>

js

Page{

data:{

},

 

change:function(ev){

  console.log(‘ ev.detail.value ’)

},

 

12. Navigator 跳转 *****

关键词:Navigatorbutton

语法及代码:

wxml

<navigator  url=’../logs/logs’>

  <button>跳转</button>

</navigator>

 

13. Wx.request 数据请求 *****

关键词:wx.requesturlsuccessfailcompletemethodheaderdataType

语法及代码:

js

onload:function(option){

  Wx.request{{

    url:’http://www.baidu.com’, <!----微信小程序中的域名必须是合法的域名--->

    success:funciton(rsp){

      Console.log(rsp)

},

fail:funciton(rsp){

  console.log(rsp)

},

complete:function(rsp){

  console.log(‘完成’)

},

method:’GET’,

header:{

  ‘ ’ : ’ ‘

},

Datatype:’json’

}}

},


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值