12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <rich-text :nodes="info.content"></rich-text>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- export default {
- components: {},
- data() {
- return {
- id: "",
- info: {},
- };
- },
- onLoad: function(e) {
- const that = this;
- that.$set(that, `id`, e.id || "");
- that.search();
- },
- methods: {
- async search() {
- const that = this;
- const res = await that.$api(`/banner/${that.id}`, "GET");
- if (res.errcode == "0") {
- let data = res.data;
- if (data.content) data.content = data.content.replace(/\<img/gi, '<img class="rich-img"');
- that.$set(that, `info`, data);
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: "none",
- });
- }
- },
- },
- };
- </script>
- <style lang="scss">
- .main {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 100vh;
- .one {
- padding: 2vw;
- .rich-img {
- width: 100% !important;
- display: block;
- }
- }
- }
- </style>
|