uni-base

作者: ddsfec | 来源:发表于2019-03-11 15:11 被阅读0次

一、创建项目

使用脚手架的话 vue create -p dcloudio/uni-preset-vue my-project

二、生命周期

onLoad:function (option) {

//获取上个路由的传参

this.$data.id=option.id;

this.requestData();

},

mounted:function(){

//eventbus回调

bus.$on("call1",(message)=>{

this.showimg=message;

console.log(message);

});

//获取缓存

try {

                var value = uni.getStorageSync("jizhumima");

                if ("true"===value) {

this.param.username=uni.getStorageSync('mima_account');

this.param.password=uni.getStorageSync('mima_password');

        }else if("false"===value){

            }

            } catch (e) {

            console.log(value+'login。v 69line');

            }

}

三、条件渲染

//外层

<view v-for="(item,index) in bean.ui" :key='index' style="margin-bottom: 2upx;background: #FFFFFF;">

  <view class='layout' >

<view id="pointRoot">

<!-- 文本 -->

<text class='tv'>{{item.doc}}</text>

<!-- * -->

<text class='point' v-if="item.need">*</text>

</view>

<!-- 横输入框 -->

<input class="edit-hor" :placeholder="item.hint" v-model="item.value" v-if="item.orientation === orientation.horizontal"></input>

<!-- 单选 -->

<radio-group class='group' @change="radiochage($event ,item)">

//两层循环item不能都叫item

<label style="display: flex;"  v-for="(ritem, index2) in item.rGroup" :key="index2">

                    <view>

                        <radio  :value="ritem.v" :checked="ritem.v===item.value" />

                    </view>

                    <div style="white-space:nowrap; ">{{ritem.r}}</div>

                </label>

</radio-group>

</view>

<!-- 竖输入框 -->

<view style="background: #FFFFFF;" v-if="item.orientation === orientation.vertical">

<div style='height: 20upx; background: #FFFFFF;'></div>

    <input class="edit-ver" :placeholder="item.hint" v-model="item.value"  ></input>

        <div style='height: 20upx; background: #FFFFFF;'></div>

</view>

</view>

相关文章

  • uni-base

    一、创建项目 使用脚手架的话 vue create -p dcloudio/uni-preset-vue my-p...

网友评论

      本文标题:uni-base

      本文链接:https://www.haomeiwen.com/subject/rjavpqtx.html