鸿蒙 js中dialog 怎么取消默认的圆角属性?

<dialog id="simpledialog" class="dialog-main" oncancel="cancelDialog">
    <div class="dialog-div">
        <text class="txt">分享</text>
    </div>
</dialog>

dialog
js
2021-09-01 18:00:43
浏览
3
收藏 1
回答 3
回答 3
按赞同
/
按时间
红叶亦知秋
2

问题解决方案如下:

border-radius: 0px;

代码如下

<!-- xxx.hml -->
<div class="doc-page">
    <div class="btn-div">
        <button type="capsule" value="Click here" class="btn" onclick="showDialog"></button>
    </div>
    <dialog id="simpledialog" class="dialog-main" oncancel="cancelDialog">
        <div class="dialog-div">
            <div class="inner-txt">
                <text class="txt">Simple dialog</text>
            </div>
            <div class="inner-btn">
                <text type="capsule"onclick="cancelSchedule" class="btn-txt">Cancel</text>
                <text type="capsule"  onclick="setSchedule" class="btn-txt">Confirm</text>
            </div>
        </div>
    </dialog>
</div>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
/* xxx.css */
.doc-page {
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.btn-div {
    width: 100%;
    height: 200px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.txt {
    color: #000000;
    font-weight: bold;
    font-size: 39px;
}
.dialog-main {
    width: 500px;
}
.dialog-div {
    flex-direction: column;
    align-items: center;
}
.inner-txt {
    width: 400px;
    height: 160px;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
}
.inner-btn {
    width: 400px;
    height: 120px;
    justify-content: space-around;
    align-items: center;
}
.btn-txt{
     border-radius: 25px;
    background-color: yellow;
    border-radius: 0px;
    padding: 20px;
    width: 100px;
    height: 150px;
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
// xxx.js
import prompt from '@system.prompt';

export default {
    showDialog(e) {
        this.$element('simpledialog').show()
    },
    cancelDialog(e) {
        prompt.showToast({
            message: 'Dialog cancelled'
        })
    },
    cancelSchedule(e) {
        this.$element('simpledialog').close()
        prompt.showToast({
            message: 'Successfully cancelled'
        })
    },
    setSchedule(e) {
        this.$element('simpledialog').close()
        prompt.showToast({
            message: 'Successfully confirmed'
        })
    }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.

 

回复来自:华为开发者联盟开发者支持团队

已于2021-9-3 14:38:41修改
分享
微博
QQ
微信
回复1
2021-09-03 14:37:52
ltkk12334
1

非常受益,学习到了很多

分享
微博
QQ
微信
回复
2021-09-03 21:30:33
lidb003昵称
原来如此
分享
微博
QQ
微信
回复1
2021-09-03 21:58:29
相关问题
HarmonyOS 怎么取消 Text默认内边距
1333浏览 • 1回复 待解决
HarmonyOS TextInput 取消默认焦点
1109浏览 • 1回复 待解决
如何取消Button默认按压效果?
1422浏览 • 1回复 待解决
HarmonyOS 怎么给类属性默认
2220浏览 • 1回复 待解决
HarmonyOS bindSheet默认圆角值是多少?
1219浏览 • 1回复 待解决
TextInput如何取消默认聚焦效果
3348浏览 • 1回复 待解决
HarmonyOS 类属性默认值问题
1088浏览 • 1回复 待解决
鸿蒙怎么实现自定义布局Dialog
10113浏览 • 2回复 已解决
HarmonyOS CustomDialog怎么设置圆角
989浏览 • 1回复 待解决
HarmonyOS 悬浮窗圆角怎么处理?
1075浏览 • 1回复 待解决