uni-app 之 图片
获取图片 v-bind 动态绑定
image.png
- <template>
- <view>
- <view>
- --- 获取图片1 ---
- <image src="../../static/img/tabbar_home1.png"></image>
- </view>
-
- <view>
- --- 获取图片2 v-bind 动态绑定---
- <image v-bind:src="img"></image>
- </view>
-
- <view>
- --- 获取图片3 :简写 ---
- <image :src="img"></image>
- </view>
-
- <view>
- --- 获取图片4 :循环获取 ---
- <image :src="'../../static/img/tabbar_home'+item+'.png'" v-for="item in [1,2]"></image>
- </view>
-
- </view>
- </template>
-
- <script>
- export default {
- data() {
- return {
-
- img: "../../static/img/tabbar_home1.png"
-
- }
- },
- methods: {
-
- }
- }
- </script>
-
- <style>
- image {
- width: 50rpx;
- height: 50rpx;
- }
- </style>