引入TDesign

This commit is contained in:
zhengyi 2023-03-01 23:01:57 +08:00
parent ecb8ade6c5
commit 8d8839050c
14 changed files with 136 additions and 23 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules/
package-lock.json
miniprogram_npm/

View File

@ -1,6 +1,7 @@
{
"pages":[
"pages/index/index",
"pages/poem-list/poem-list",
"pages/logs/logs"
],
"window":{
@ -9,6 +10,15 @@
"navigationBarTitleText": "Weixin",
"navigationBarTextStyle":"black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
"sitemapLocation": "sitemap.json",
"tabBar": {
"list": [{
"pagePath": "pages/index/index",
"text": "首页"
}, {
"pagePath": "pages/poem-list/poem-list",
"text": "诗词库"
}],
"custom": true
}
}

17
custom-tab-bar/index.js Normal file
View File

@ -0,0 +1,17 @@
Component({
data: {
value: 'label_1',
list: [
{ value: 'label_1', label: '首页', icon: 'home' },
{ value: 'label_2', label: '应用', icon: 'app' },
{ value: 'label_3', label: '聊天', icon: 'chat' },
{ value: 'label_4', label: '我的', icon: 'user' },
],
},
methods: {
onChange(e) {
console.log(e);
},
},
});

View File

@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"t-tab-bar": "tdesign-miniprogram/tab-bar/tab-bar",
"t-tab-bar-item": "tdesign-miniprogram/tab-bar-item/tab-bar-item"
}
}

View File

@ -0,0 +1,5 @@
<t-tab-bar value="{{value}}" bindchange="onChange" theme="tag" split="{{false}}">
<t-tab-bar-item wx:for="{{list}}" wx:key="index" value="{{item.value}}" icon="{{item.icon}}">
{{item.label}}
</t-tab-bar-item>
</t-tab-bar>

View File

@ -0,0 +1 @@
/* components/tab-bar/tab-bar.wxss */

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "poem-native",
"version": "1.0.0",
"description": "",
"main": ".eslintrc.js",
"dependencies": {
"tdesign-miniprogram": "^1.0.1"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}

View File

@ -1,3 +1,4 @@
{
"usingComponents": {}
"usingComponents": {
}
}

View File

@ -1,23 +1,3 @@
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<block wx:if="{{canIUseOpenData}}">
<view class="userinfo-avatar" bindtap="bindViewTap">
<open-data type="userAvatarUrl"></open-data>
</view>
<open-data type="userNickName"></open-data>
</block>
<block wx:elif="{{!hasUserInfo}}">
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
<button wx:elif="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
<view wx:else> 请使用1.4.4及以上版本基础库 </view>
</block>
<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 File

@ -0,0 +1,66 @@
// pages/poem-list/poem-list.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,2 @@
<!--pages/poem-list/poem-list.wxml-->
<text>pages/poem-list/poem-list.wxml</text>

View File

@ -0,0 +1 @@
/* pages/poem-list/poem-list.wxss */

View File

@ -5,6 +5,8 @@
"include": []
},
"setting": {
"ignoreDevUnusedFiles": false,
"ignoreUploadUnusedFiles": false,
"bundle": false,
"userConfirmedBundleSwitch": false,
"urlCheck": true,