feat: 设置alias别名@=>src, 以及城市图片展示
This commit is contained in:
@@ -1,12 +1,17 @@
|
|||||||
import { defineConfig } from '@tarojs/cli'
|
import { defineConfig } from '@tarojs/cli'
|
||||||
|
// import * as path from 'path'; //引入node的path模块
|
||||||
|
|
||||||
import devConfig from './dev'
|
import devConfig from './dev'
|
||||||
import prodConfig from './prod'
|
import prodConfig from './prod'
|
||||||
|
const path = require('path'); //引入node的path模块
|
||||||
|
|
||||||
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
|
// https://taro-docs.jd.com/docs/next/config#defineconfig-辅助函数
|
||||||
export default defineConfig(async (merge, { command, mode }) => {
|
export default defineConfig(async (merge, { command, mode }) => {
|
||||||
const baseConfig = {
|
const baseConfig = {
|
||||||
projectName: 'yidooplanet',
|
projectName: 'yidooplanet',
|
||||||
|
alias: {
|
||||||
|
'@': path.resolve(__dirname, '..', 'src')
|
||||||
|
},
|
||||||
date: '2024-3-19',
|
date: '2024-3-19',
|
||||||
designWidth: 750,
|
designWidth: 750,
|
||||||
deviceRatio: {
|
deviceRatio: {
|
||||||
|
|||||||
BIN
src/images/city/beijing.jpg
Normal file
BIN
src/images/city/beijing.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
@@ -1,9 +1,10 @@
|
|||||||
import { View, Text } from "@tarojs/components";
|
import { View, Text, Image } from "@tarojs/components";
|
||||||
import { useLoad } from "@tarojs/taro";
|
import { useLoad } from "@tarojs/taro";
|
||||||
import { AtButton } from "taro-ui";
|
|
||||||
import { AtIcon } from "taro-ui";
|
import { AtAvatar, AtTag, AtIcon } from "taro-ui";
|
||||||
import { AtAvatar } from "taro-ui";
|
|
||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
|
import beijing from "@/images/city/beijing.jpg";
|
||||||
|
// import beijing from "../../images/city/beijing.jpg";
|
||||||
|
|
||||||
export default function Index() {
|
export default function Index() {
|
||||||
useLoad(() => {
|
useLoad(() => {
|
||||||
@@ -14,7 +15,14 @@ export default function Index() {
|
|||||||
return [1, 2, 3].map((item, index) => {
|
return [1, 2, 3].map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<View className="homeCardItem">
|
<View className="homeCardItem">
|
||||||
<View className="homeCard">left</View>
|
<View className="homeCard">
|
||||||
|
{/* 城市封面图片 */}
|
||||||
|
<Image
|
||||||
|
style="width: 100%;height: 100%;background: #fff;"
|
||||||
|
mode="scaleToFill"
|
||||||
|
src={beijing}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
<View className="homeCard">right</View>
|
<View className="homeCard">right</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
@@ -26,9 +34,28 @@ export default function Index() {
|
|||||||
{/* 顶部 */}
|
{/* 顶部 */}
|
||||||
<View className="indexHeader">
|
<View className="indexHeader">
|
||||||
{/* 头像 */}
|
{/* 头像 */}
|
||||||
<AtAvatar circle image="https://jdc.jd.com/img/200"></AtAvatar>
|
<AtAvatar circle image=""></AtAvatar>
|
||||||
<AtIcon value='chevron-down' size='30' color='#F00'></AtIcon>
|
{/* color="#F00" */}
|
||||||
|
<AtIcon value="chevron-down" size="30"></AtIcon>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 省份标签 */}
|
||||||
|
<View className="provinceTag">
|
||||||
|
<AtTag type="primary" circle>
|
||||||
|
北京
|
||||||
|
</AtTag>
|
||||||
|
<AtTag type="primary" circle>
|
||||||
|
上海
|
||||||
|
</AtTag>
|
||||||
|
<AtTag type="primary" circle>
|
||||||
|
广州
|
||||||
|
</AtTag>
|
||||||
|
<AtTag type="primary" circle>
|
||||||
|
深圳
|
||||||
|
</AtTag>
|
||||||
|
<AtTag type="primary" circle>
|
||||||
|
武汉
|
||||||
|
</AtTag>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 城市列表 */}
|
{/* 城市列表 */}
|
||||||
|
|||||||
@@ -7,8 +7,16 @@
|
|||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
// justify-content: space-between;
|
// justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.provinceTag {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
// justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.homeCards {
|
.homeCards {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
Reference in New Issue
Block a user