Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
259d4002
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
716
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
259d4002
编写于
11月 13, 2018
作者:
郭
郭胜强
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:dcloudio/uni-app
上级
e82ebfd4
e3228335
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
30 deletion
+32
-30
examples/hello-uniapp/components/ly-markdown/ly-markdown.vue
examples/hello-uniapp/components/ly-markdown/ly-markdown.vue
+29
-27
examples/hello-uniapp/pages/component/rich-text/rich-text.vue
...ples/hello-uniapp/pages/component/rich-text/rich-text.vue
+3
-3
未找到文件。
examples/hello-uniapp/components/ly-markdown/ly-markdown.vue
浏览文件 @
259d4002
...
...
@@ -19,12 +19,12 @@
<view
class=
"iconfont icon-qingkong"
@
click=
"toolBarClick('clear')"
></view>
</view>
<view
class=
"input-content"
>
<textarea
auto-height
maxlength=
"-1"
v-model=
"textareaData"
@
blur=
"getCursor"
></textarea>
<textarea
auto-height
maxlength=
"-1"
v-model=
"textareaData
Sync
"
@
blur=
"getCursor"
></textarea>
</view>
</view>
<view
class=
"preview"
v-if=
"showPreview && textareaHtml"
>
<view
class=
"preview"
v-if=
"showPreview && textareaHtml
Sync
"
>
<scroll-view
scroll-y
:style=
"'height:'+screenHeight/2.5+'px;padding:10px;box-sizing: border-box;'"
>
<wxParse
:content=
"textareaHtml"
@
preview=
"preview"
@
navigate=
"navigate"
/>
<wxParse
:content=
"textareaHtml
Sync
"
@
preview=
"preview"
@
navigate=
"navigate"
/>
</scroll-view>
</view>
</view>
...
...
@@ -41,7 +41,9 @@
data
:
function
()
{
return
{
screenHeight
:
0
,
cursor
:
0
cursor
:
0
,
textareaDataSync
:
this
.
textareaData
,
textareaHtmlSync
:
this
.
textareaHtml
}
},
props
:
{
...
...
@@ -83,64 +85,64 @@
},
toolBarClick
(
type
)
{
if
(
type
==
'
bold
'
)
{
this
.
textareaData
+=
"
**粗体文字**
"
this
.
textareaData
Sync
+=
"
**粗体文字**
"
}
else
if
(
type
==
"
italic
"
)
{
this
.
textareaData
+=
"
*斜体*
"
this
.
textareaData
Sync
+=
"
*斜体*
"
}
else
if
(
type
==
"
header
"
)
{
uni
.
showActionSheet
({
itemList
:
[
"
标题1
"
,
"
标题2
"
,
"
标题3
"
,
"
标题4
"
,
"
标题5
"
,
"
标题6
"
],
success
:
res
=>
{
switch
(
res
.
tapIndex
)
{
case
0
:
this
.
textareaData
+=
"
# 标题1
\r
"
;
this
.
textareaData
Sync
+=
"
# 标题1
\r
"
;
return
;
case
1
:
this
.
textareaData
+=
"
## 标题2
\r
"
;
this
.
textareaData
Sync
+=
"
## 标题2
\r
"
;
return
;
case
2
:
this
.
textareaData
+=
"
### 标题3
\r
"
;
this
.
textareaData
Sync
+=
"
### 标题3
\r
"
;
return
;
case
3
:
this
.
textareaData
+=
"
#### 标题4
\r
"
;
this
.
textareaData
Sync
+=
"
#### 标题4
\r
"
;
return
;
case
4
:
this
.
textareaData
+=
"
##### 标题5
\r
"
;
this
.
textareaData
Sync
+=
"
##### 标题5
\r
"
;
return
;
case
5
:
this
.
textareaData
+=
"
###### 标题6
\r
"
;
this
.
textareaData
Sync
+=
"
###### 标题6
\r
"
;
return
;
}
}
})
}
else
if
(
type
==
"
underline
"
)
{
this
.
textareaData
+=
"
++下划线++
"
this
.
textareaData
Sync
+=
"
++下划线++
"
}
else
if
(
type
==
"
strike
"
)
{
this
.
textareaData
+=
"
~~中划线~~
"
this
.
textareaData
Sync
+=
"
~~中划线~~
"
}
else
if
(
type
==
"
sup
"
)
{
this
.
textareaData
+=
"
^上角标^
"
this
.
textareaData
Sync
+=
"
^上角标^
"
}
else
if
(
type
==
"
sub
"
)
{
this
.
textareaData
+=
"
~下角标~
"
this
.
textareaData
Sync
+=
"
~下角标~
"
}
else
if
(
type
==
"
alignleft
"
)
{
this
.
textareaData
+=
"
\n
::: hljs-left
\n\n
左对齐
\n\n
:::
\n
"
this
.
textareaData
Sync
+=
"
\n
::: hljs-left
\n\n
左对齐
\n\n
:::
\n
"
}
else
if
(
type
==
"
aligncenter
"
)
{
this
.
textareaData
+=
"
\n
::: hljs-center
\n\n
居中对齐
\n\n
:::
\n
"
this
.
textareaData
Sync
+=
"
\n
::: hljs-center
\n\n
居中对齐
\n\n
:::
\n
"
}
else
if
(
type
==
"
alignright
"
)
{
this
.
textareaData
+=
"
\n
::: hljs-right
\n\n\n\n
右对齐
\n\n
:::
\n
"
this
.
textareaData
Sync
+=
"
\n
::: hljs-right
\n\n\n\n
右对齐
\n\n
:::
\n
"
}
else
if
(
type
==
"
link
"
)
{
this
.
textareaData
+=
"
[在此输入网址描述](在此输入网址)
"
this
.
textareaData
Sync
+=
"
[在此输入网址描述](在此输入网址)
"
}
else
if
(
type
==
"
imgage
"
)
{
this
.
textareaData
+=
"
![](在此输入图片地址)
"
this
.
textareaData
Sync
+=
"
![](在此输入图片地址)
"
}
else
if
(
type
==
"
code
"
)
{
this
.
textareaData
+=
"
\n
``` 代码块
\n\n
```
\n
"
this
.
textareaData
Sync
+=
"
\n
``` 代码块
\n\n
```
\n
"
}
else
if
(
type
==
"
table
"
)
{
this
.
textareaData
+=
"
\n
|列1|列2|列3|
\n
|-|-|-|
\n
|单元格1|单元格2|单元格3|
\n
"
this
.
textareaData
Sync
+=
"
\n
|列1|列2|列3|
\n
|-|-|-|
\n
|单元格1|单元格2|单元格3|
\n
"
}
else
if
(
type
==
"
clear
"
)
{
uni
.
showModal
({
title
:
"
提示
"
,
content
:
"
确定清空?
"
,
success
:
res
=>
{
if
(
res
.
confirm
)
{
this
.
textareaData
=
""
;
this
.
textareaData
Sync
=
""
;
}
}
})
...
...
@@ -152,10 +154,10 @@
}
},
watch
:
{
"
textareaData
"
:
function
(
newValue
,
oldValue
)
{
this
.
textareaHtml
=
marked
(
newValue
)
"
textareaData
Sync
"
:
function
(
newValue
,
oldValue
)
{
this
.
textareaHtml
Sync
=
marked
(
newValue
)
this
.
$emit
(
'
update:textareaData
'
,
newValue
)
this
.
$emit
(
'
update:textareaHtml
'
,
this
.
textareaHtml
)
this
.
$emit
(
'
update:textareaHtml
'
,
this
.
textareaHtml
Sync
)
}
},
mounted
:
function
()
{
...
...
examples/hello-uniapp/pages/component/rich-text/rich-text.vue
浏览文件 @
259d4002
...
...
@@ -4,17 +4,17 @@
<view
class=
"uni-padding-wrap"
>
<view
class=
"uni-title uni-common-mt"
>
数组类型
<text>
\nnodes属性为A
arr
y
</text>
<text>
\nnodes属性为A
rra
y
</text>
</view>
<view
class=
"uni-common-mt"
style=
"background:#FFF; padding:20upx;"
>
<rich-text
:nodes=
"nodes"
@
tap=
"tap"
></rich-text>
<rich-text
:nodes=
"nodes"
></rich-text>
</view>
<view
class=
"uni-title uni-common-mt"
>
字符串类型
<text>
\nnodes属性为String
</text>
</view>
<view
class=
"uni-common-mt"
style=
"background:#FFF; padding:20upx;"
>
<rich-text
:nodes=
"strings"
@
tap=
"tap"
></rich-text>
<rich-text
:nodes=
"strings"
></rich-text>
</view>
</view>
</view>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录