- Dec 17 Tue 2024 13:54
Vue專案部屬於Azure static App上
- Nov 25 Mon 2024 10:08
Line Id轉換成Url,可以自行帶入查詢
- May 22 Wed 2024 17:07
快速刪除node_modules方法
方法1:
npm install rimraf -g
- Feb 20 Tue 2024 14:14
[MS SQL]查詢含特定文字的Stored Procedure或View
太常查詢了,筆記一下
[MS SQL]查詢含特定文字的Stored Procedure或view
- Jun 25 Sat 2022 17:00
在Gitlab中使用Gif做大頭貼
- Jun 24 Fri 2022 17:00
[C#]ORA-00911: invalid character
- Jun 23 Thu 2022 17:00
introjs網站導覽功能
- Jun 22 Wed 2022 17:00
Vuetify 表單驗證簡易說明
- Jun 21 Tue 2022 21:31
頁面閱讀光條
- May 31 Tue 2022 22:42
vue3 wangeditor3.0 版本 光標跳到最後問題
最近遇到一個問題,在使用vue3的wangeditor3.0 ,發現在輸入文字後,文字的光標會自行的跳到最後一個字,導致打字非常麻煩
<template> <div class="editor-container"> <div :id="id"></div> </div> </template> <script lang="ts"> import { toRefs, reactive, onMounted, watch } from 'vue'; import wangeditor from 'wangeditor'; export default { name: 'wngEditor', props: { id: { type: String, default: () => 'wangeditor', }, // 是否禁用 isDisable: { type: Boolean, default: () => false, }, // 雙像綁定 // 参考:https://v3.cn.vuejs.org/guide/migration/v-model.html#%E8%BF%81%E7%A7%BB%E7%AD%96%E7%95%A5 modelValue: String, }, setup(props, { emit }) { const state = reactive({ editor: null, isChanged : false, }); // 初始化 // https://doc.wangeditor.com/ const initWangeditor = () => { state.editor = new wangeditor(`#${props.id}`); state.editor.config.placeholder = '請輸入內容'; state.editor.config.uploadImgShowBase64 = true; state.editor.config.showLinkImg = false; onWangeditorChange(); state.editor.create(); state.editor.txt.html(props.modelValue); props.isDisable ? state.editor.disable() : state.editor.enable(); }; // 内容改變時 const onWangeditorChange = () => { state.editor.config.onchange = (html: string) => { state.isChanged = true; //標記改變 emit('update:modelValue', html); }; }; // 監聽雙像綁定值 // https://gitee.com/lyt-top/vue-next-admin/issues/I4LM7I watch( () => props.modelValue, (value) => { if(!state.isChanged) state.editor.txt.html(value); state.isChanged = false; } ); onMounted(() => { initWangeditor(); }); return { ...toRefs(state), }; }, }; </script>