该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

-- wqy的笔记 --

1 引入插件 gaoyia-parse

链接:https://pan.baidu.com/s/1UusfXxHhHcoaKpUVFE2Xqw

提取码:zuqt

2 创建组件 rich-content.vue

```

//视频和文本解析组件

import uParse from '@/components/gaoyia-parse/parse.vue'

export default {

name: 'wang-content',

components: {

uParse

},

props: {

content: {}

},

created() {},

methods: {

preview(src, e) {

// do something

},

navigate(href, e) {

// do something

}

}

}

```

在详情页面 details.vue 中 引入组件

```

import wangContent from '@/components/wang/rich-content.vue';

components: {

wangContent

}

```

完整代码如下

```

import wangContent from '@/components/wang/rich-content.vue';

export default {

components: {

wangContent

},

onLoad(option) {

if (typeof option.id !== 'undefined' && option.id) {

this.gid = option.id

} else {

uni.showToast({

title: '缺少商品id',

icon: 'none'

})

uni.navigateBack({

delta: 1

})

return false

}

this.getInfo()

},

data() {

return {

content:''

}

},

methods: {

getInfo(){

var params = {

goods_id:this.gid

}

this.$api.goods_info(params,res=>{

this.content = res.data.intro

})

}

}

}

```

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐