app開發中讀取資料庫資訊的vue頁面

來源:互聯網
上載者:User

標籤:module   row   代理   nbsp   stream   gif   get   edit   orm   

<template>
<!-- 容器 -->
<div class="container">

<!-- 標題 -->
<div class="header" :style="{ height: height }">
<wxc-minibar background-color="#fff"
text-color="#1a1a1a"
:title="titles"
@wxcMinibarLeftButtonClicked="minibarLeftButtonClick">

<!-- 圖片位置 -->
<image slot="right" @click="jump(‘employEdit‘)" class="icon-add" src="../../../web/assets/images/icon-add.png"></image>

</wxc-minibar>
</div>

<list class="list">

<!-- list容器 -->
<cell class="list-cell" v-for="num in list" @click="jump(‘employEdit‘,1)">
<div class="list-box">
<image class="menu-img" src="../../../web/assets/images/icon-find-maintenance.png"></image>

<span class="list-m">
<text class="set-name">{{num.employeeName+"員工"}}</text>
<!-- <text class="set-addr">{{num.employeePhone}}</text> -->
</span>

<image class="icon-triggle" src="../../../web/assets/images/icon-triggle.png"></image>
</span>
</div>
</cell>
</list>
</div>
</template>

<script>


import { WxcMinibar,WxcCell,WxcTabPage, WxcPanItem, Utils, BindEnv } from ‘weex-ui‘;
//不變的
const modal = weex.requireModule(‘modal‘);
//定義變數
var stream = weex.requireModule(‘stream‘);


export default {
//組件
components: { WxcMinibar,WxcCell },
data(){
return{
height:88,
titles:‘員工管理‘,
//定義list
list: []
}
},



created: function() {
var me = this;


},

//安裝
mounted:function(){
var me = this;
console.log(6666666666666);
//資料接收發出
stream.fetch({
method: ‘POST‘,
url: ‘/api/employee/findAll?name=‘+1,
type:‘json‘
}, function(ret) {
if(!ret.ok){
console.log("123");
me.getJsonpResult = "request failed";
}else{
me.list = ret.data;
//控制台列印 類似alert()

console.log(me.list[0].employeeName+"列印進來了");
}
//響應
},function(response){
//取得進展
console.log(‘get jsonp in progress:‘+response.length);
//接收的位元組數
me.getJsonpResult = "你好!!!:"+response.length;
console.log(‘最後返回:‘+response.length);

});
},


/*
stream Demo示範
stream.fetch({
method: ‘POST‘,
url: POST_URL,
type:‘json‘
}, function(ret) {
if(!ret.ok){

me.postResult = "request failed";
}else{
console.log(‘get:‘+JSON.stringify(ret));
me.postResult = JSON.stringify(ret.data);
}
},function(response){
console.log(‘get in progress:‘+response.length);
me.postResult = "bytes received:"+response.length;
});
*/

 

 


//預估
beforeCreate: function() {
//文檔標記名
document.getElementsByTagName("body")[0].style.backgroundColor="#f4f4f4";
},
methods: {

 

toParams(obj){
var param = "";
for(const name in obj){
if(typeof obj[name] != ‘function‘){
param += "&" + "=" + encodeURI(obj[name]);
}
}
return param.substring(1);
},

 

 

 


//小左按鈕
minibarLeftButtonClick () {
},
//小右按鈕
minibarRightButtonClick () {
modal.toast({ ‘message‘: ‘click rightButton!‘, ‘duration‘: 1 });
},
//點擊
wxcCellClicked (e) {
console.log(e)
},
//跳轉
jump(urlName,id){
// this.$router.push({name: urlName,params:{Id:id}});

/*第一個參數是跳轉路徑,第二個參數是代理商id*/
this.$router.push({name: urlName,params:{id:id}});
}
}
};

 

</script>
<style scoped>
.header{
z-index: 9999;
position: fixed;
top:0;
width: 100%;
border-bottom: 1px solid #e5e5e5;
}
.icon-add{
width: 29px;
height: 29px;
}
.container{
padding-top: 88px;
}
.list,.list-cell{
width: 750px;
}
.list{
padding-bottom: 98px;
}
.list-cell{
padding: 24px 20px;
border-bottom: 1px solid #f4f4f4;
background-color: #fff;
}
.list-box{
width: 100%;
flex-direction: row;
}
.text-name{
margin-bottom: 16px;
font-size: 28px;
color: #333333;
}

.list-m{
flex: 1;
padding:0 0 0 20px;
}
.list-r{
padding-top: 10px;
}

.text-status.color-has .color-n{
display: inline-block;
padding: 0 4px;
font-size: 26px;
background-color: #e5e5e5;
color: #999;
border-radius: 4px;
}
.set-name{
font-size: 28px;
line-height: 100px;
color: #333333;
}
.icon-triggle{
position: absolute;
right: 20px;
top: 50%;
transform: translateY(-50%);
width: 17px;
height: 28px;
}
.menu-img{
width: 100px;
height: 100px;
border-radius: 4px;
}

</style>

app開發中讀取資料庫資訊的vue頁面

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.