Skip to content

Commit

Permalink
修改模版文件
Browse files Browse the repository at this point in the history
  • Loading branch information
by_xiaoyuan committed Jul 17, 2019
1 parent f91c5ee commit 24fcbe8
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 54 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -53,7 +53,7 @@ module.exports = {
component
```

##### 创建page
#### 创建page

```bash
# 输入页面名称
Expand All @@ -67,7 +67,7 @@ module.exports = {
```


##### 创建component
#### 创建component

```bash
# 输入组件名称
Expand All @@ -90,7 +90,7 @@ module.exports = {
```


##### 自定义模版文件
#### 自定义模版文件

每个项目可能需要的模版都不太一致,xdk-cli提供一个文件夹插槽,方便自定义需要使用的模版

Expand Down
2 changes: 1 addition & 1 deletion lib/create-program-fs.js
Expand Up @@ -86,7 +86,7 @@ async function createPage(name, modulePath = '') {
}

// 业务文件夹路径
let page_root = path.join(Config.appRoot, modulePath, '/page', name);
let page_root = path.join(Config.appRoot, modulePath, '/pages', name);

// 查看文件夹是否存在
let isExists = await Util.checkFileIsExists(page_root);
Expand Down
4 changes: 3 additions & 1 deletion template/component/component.js
Expand Up @@ -8,7 +8,9 @@ Component({
/**
* 组件的内部数据,和 properties 一同用于组件的模板渲染
*/
data: {},
data: {
title: 'hello 我是小打卡组件模版 ~ !!'
},

/**
* 组件生命周期函数-在组件实例刚刚被创建时执行,注意此时不能调用 setData )
Expand Down
7 changes: 0 additions & 7 deletions template/component/component.scss

This file was deleted.

6 changes: 1 addition & 5 deletions template/component/component.wxml
@@ -1,5 +1 @@
<view>
<view class="title-text" >
hello 我是小打卡组件模版 ~ !!
</view>
</view>
<view>{{title}}</view>
Empty file.
33 changes: 30 additions & 3 deletions template/page/page.js
Expand Up @@ -4,10 +4,37 @@ const app = getApp();

Page({
data: {
motto: 'Hello World',
title: 'hello 我是小打卡页面模版 ~ !!',
},
onLoad: function () {
console.log(this.data.motto);

/**
* 页面加载
*/
onLoad(options) {
},

/**
* 页面展示
*/
onShow() {
},

/**
* 页面渲染成功
*/
onReady() {
},

/**
* 页面隐藏
*/
onHide() {
},

/**
* 页面卸载
*/
onUnload() {
},

});
14 changes: 1 addition & 13 deletions template/page/page.wxml
@@ -1,13 +1 @@
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<block wx:else>
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
</block>
</view>
<view class="usermotto">
<text class="user-motto">{{motto}}</text>
</view>
</view>
<view>{{title}}</view>
21 changes: 0 additions & 21 deletions template/page/page.wxss
@@ -1,21 +0,0 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: column;
align-items: center;
}

.userinfo-avatar {
width: 128rpx;
height: 128rpx;
margin: 20rpx;
border-radius: 50%;
}

.userinfo-nickname {
color: #aaa;
}

.usermotto {
margin-top: 200px;
}

0 comments on commit 24fcbe8

Please sign in to comment.