1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <template>
- <view class="u-demo-block">
- <view class="u-demo-block-content">
- <view class="u-alert-item" v-for="(item,index) in myData.msgList" :key="index">
- <u-alert class="alert" :description="item" type="warning" effect="dark" closable
- @click="deleteMsg(index)"></u-alert>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- export default {
- computed: {
- ...mapState('m_parent', ['myData'])
- },
- data() {
- return {};
- },
- methods: {
- ...mapMutations('m_parent', ['updateMyMsg']),
- //删除信息
- deleteMsg(index) {
- let msgList = this.myData.msgList
- let after = msgList.splice(index, 1)
- this.updateMyMsg(after)
- }
- }
- }
- </script>
- <style lang="scss">
- .u-alert-item {
- margin: 20rpx;
- }
- </style>
|