|
|
@@ -1,55 +0,0 @@
|
|
|
-// component/parse/parse.js
|
|
|
-const wxparse = require('./wxParse/wxParse.js')
|
|
|
-Component({
|
|
|
- /**
|
|
|
- * 组件的属性列表
|
|
|
- */
|
|
|
- properties: {
|
|
|
- parseContent: {
|
|
|
- type: null,
|
|
|
- observer(parseContent) {
|
|
|
- let json = '';
|
|
|
- if (typeof parseContent === 'object') {
|
|
|
- json = Object.assign({
|
|
|
- content: '数据不能为空',
|
|
|
- padding: 0
|
|
|
- }, parseContent)
|
|
|
- } else {
|
|
|
- try {
|
|
|
- json = {
|
|
|
- content: parseContent.toString(),
|
|
|
- padding: 0
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- console.log(`参数格式为:
|
|
|
- {
|
|
|
- content: '数据',
|
|
|
- padding: 0
|
|
|
- }
|
|
|
- 或者
|
|
|
-
|
|
|
- 字符串
|
|
|
- `)
|
|
|
- throw new TypeError('参数格式错误!')
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- wxparse.wxParse('article', 'html', json.content, this, json.padding)
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 组件的初始数据
|
|
|
- */
|
|
|
- data: {
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 组件的方法列表
|
|
|
- */
|
|
|
- methods: {
|
|
|
-
|
|
|
- }
|
|
|
-})
|